-   Linux - Newbie (
-   -   Show a certain line in file (

shahgols 03-22-2007 08:34 AM

Show a certain line in file
Hi everyone,

I have a very big text file with over 100 million rows. I want to look at rows 36,000,000 through 36,000,005 for example, how would I do that using the command line? Thanks.

titopoquito 03-22-2007 09:01 AM

sed -n '36000000,36000005P' <logfile>

pixellany 03-22-2007 09:13 AM

I am pretty sure that sed will do this. Here is the best sed tutorial I have seen:

A crude method is more +num filename. This starts on line "num", and continues one page at a time until stopped

shahgols 03-22-2007 09:54 AM

Thank you!

PTrenholme 03-22-2007 10:47 AM

How about tail -n +36000000 <file> | head -n 5 ?

And, if you're going to be doing this frequently, consider making the file a data base table indexed on row number, and printing the lines you need with a SQL query.

All times are GMT -5. The time now is 06:03 AM.