Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: I want to list the NEXT line after a string appears in a list of files



John Eikenberry <jae@xxxxxxxx> wrote in news:20060901151507.GA32421
@mollari.zhar.net:

> zzapper wrote:
> 
>> Hi
>> I want to list the NEXT line after a string appears in a list of files
>> 
>> eg 
>> > egrep "Anecdote" m??.txt (But display next line)
>> 
>> I guess Sed/Awk would do this, I would probably use Perl.
>> 
>> Suggestions pls
>> 
> 
> Note zsh specific, but this should work.

> egrep -A1 "Anecdote" m??.txt | tail -1
John
That's useful I thought I knew everything about grep but no!
BTW works without the tail

egrep -iA2 "^Anecdote" m??.txt 



-- 
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips



Messages sorted by: Reverse Date, Date, Thread, Author