How to "grep" out specific line ranges of a file
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-05-26T15:09:59Z
Indexed on
2010/05/26
15:21 UTC
Read the original article
Hit count: 145
command-line
|grep
There are often times I'll grep -l whatev file to find what I'm looking for. Say the output is
1234: whatev 1
5555: whatev 2
6643: whatev 3
If I want to then just extract the lines between 1234 and 5555, is there a tool to do that? For static files I have a script that does wc -l of the file and then does the math to split it out with tail & head but that doesn't work out so well with log files that are constantly being written to.
© Stack Overflow or respective owner