What's a good way of extracting say, lines 20 -45 out of a huge text file. Non-interactively of course!
Tell me more
×
Unix & Linux Stack Exchange is a question and answer site for
users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
|
|
you could try:
or
update: As Mahomedalid pointed out, If
|
|||||||||||||
|
|
Even simpler: sed -n 20,45p < textfile The -n flag disables the default output. The "20,45" addresses lines 20 to 45, inclusive. And the "p" command prints the current line. |
||||
|
Actually, you don't need the cat, with:
or
it's enough |
|||||||||
|
|
|||||||||
|
|
Since sed and awk were already taken, here is a perl solution:
Or, as pointed out in the comments:
|
|||||||||
|
