On Tue, Jun 7, 2011 at 05:26, Kenneth Porter shiva@sewingwitch.com wrote:
--On Tuesday, May 31, 2011 1:08 AM +0300 Dotan Cohen dotancohen@gmail.com wrote:
Can grep show the matching lines and the next N lines after a match?
If I'm just inspecting a file I use less and the "/" command to search up to the next occurrence of a regular expression. Use the "?" command to search backwards. See the man page for less for lots more options.
Thanks, Kenneth. I am familiar with the VIM keybindingsin less and man. I need something scriptable though.
----- Original Message ----- From: "Dotan Cohen" dotancohen@gmail.com To: "CentOS mailing list" centos@centos.org Sent: Tuesday, June 7, 2011 1:20:20 AM Subject: Re: [CentOS] Grep: show me this line and the next N lines?
On Tue, Jun 7, 2011 at 05:26, Kenneth Porter shiva@sewingwitch.com wrote:
--On Tuesday, May 31, 2011 1:08 AM +0300 Dotan Cohen dotancohen@gmail.com wrote:
Can grep show the matching lines and the next N lines after a match?
grep -A N