On 7 Nov 2001, Narayanamoorthy  Srinivasan wrote:

 |  I wrote a shell script access a very big text file which happens to
 |read the file line by line.  When i use the command "head -$LINE_NO |
 |tail -1" to retrieve a particular line, the process becomes very slow
 |when accessing a big file that contains 11,000 lines.

That's because the numbers of lines read is 2x$LINE_No .

 |  Is any other solution for it.

cat LARGEFILE | perl -e '$count=0 ;while(<>){ $count++; if($count == 10){print $_; 
exit;}}'

:o)  this will give you the 10th line of the file!

rewrite that as a proper perl script and make it accept arguments and
stuff.

Kingsly


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to