Hi, you may use
perl, tie your file to below Module, then you can treat your file as a two-dimension array by column.
Code:
package FileArray;
sub _makeArr{
$file=shift;
open FH,"<$file";
while(<FH>){
my @tmp=split(" ",$_);
for($i=0;$i<=$#tmp;$i++){
$arr[$i][$.-1]=$tmp[$i];
}
}
close FH;
}
sub TIEARRAY{
my($self,$file)=(@_);
_makeArr($file);
return bless \@arr,$self;
}
sub FETCH{
my($self,$ind)=(@_);
return $arr[$ind];
}
sub STORE{
my($self,$ind)=(@_);
return $arr[$ind];
}
1
Then use below scripts seems can help you a little.
Code:
use FileArray;
tie @arr,"FileArray","a.txt";
@brr=sort @{$arr[4]};
print "Min: $brr[0] -- Max: $brr[$#brr]\n";