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

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

 



On Mon, 2006-05-08 at 09:06 -0400, 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
> 
Exactly, and your math is wrong.  
If you want to see lines 454555 to 453590 inclusive you would need to
see 46 lines,  thus "tail -46". Your command above would show lines
453555 to 453589 and not the last one. 

The other suggestion to use sed would be the cleanest that I have seen
so far.

> On Mon, 8 May 2006 carlosreimer@xxxxxxxxxxxx wrote:
> 
> > Hello,
> >
> > How can I see the content of lines 453555 to 453590 of a big text file?
> >
> > Thanks in advance!
> >
> >
> 


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux