I have a file containing plot data. Each line has 4 coordinates in total the data file can exceed 1 GB. Let's say, I would like to get the third column in a data file, which method should consider good practice and much faster?
Using execute:
exec("awk '{ print $3 }' data", $output);
Using PHP script:
$data = file("data");
$points = array();
foreach($data as $line)
$points[] = $line[2];
Moreover, since the server does not allow to read large file, I have to use fread to read the file in several parts. But fread is not smart enough and some work must be done to combine the last line in each part. Any suggestion or any better method to read a column on a file in php?