[CentOS] Grep: show me this line and the next N lines?

Meenoo Shivdasani meenoo at gmail.com
Mon May 30 21:15:01 UTC 2011


On Mon, May 30, 2011 at 5:08 PM, Dotan Cohen <dotancohen at gmail.com> wrote:

> Can grep show the matching lines and the next N lines after a match?
>


> I would ideally grep on "[Tag h1]" and have grep display the match and
> the next 5 lines so that I see all the content of the h1 section.
>

Try

grep -A 5 pattern filename

M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20110530/b00378b1/attachment.html>


More information about the CentOS mailing list