[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How can I see content of lines 453555 until 453590 of text file?



On Monday 08 May 2006 09:06, Peter Teuben wrote:
> you could explicitly code it via awk (i'm sure perl has a shortcut for this
> too, but it's not in my head):
>
>  	awk '{if (NR>=453555 && NR<= 453590) print $0 }' your_big_file
>
> it might be a bit slow on big files though.
> tail can also be used , but you have to do math:
>
>  	tail +453555 your_big_file | tail -45
>
> give or take a line. awk is probably safer, since you don't have to think
> about 0 vs. 1 and subtract two big numbers

I may not know anything about perl or awk, but I am certain that subtracting 
453555 from 433590 gives 35, not 45. Adding one for the last fence post gives 
the result that 36 lines should be displayed.

-- cmg


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]