GNU bug report logs -
#26904
Wishlist: Tell grep to stop when a line matches something else.
Previous Next
Full log
Message #8 received at 26904 <at> debbugs.gnu.org (full text, mbox):
Hi LA,
On Sat, 13 May 2017 01:10:52 -0400
LA-notifications <at> xecu.net wrote:
> Hello.
>
> I wish I could tell grep to stop searching in a file when it gets to a
> line matching something else. So if grep is searching a file for 'foo'
> then finds a line matching 'bar', stop searching for 'foo'. It would
> help me out a lot when searching for things in my perl modules where I
> do not want my perl pod searched.
>
It may be out of the scope of GNU grep, but should be doable in perl -ln or sed.
E.g (untested):
perl -ln -E '/bar/?exit:/foo/?say:0'
Regards,
Shlomi Fish
> LA
>
>
>
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/facts/Emma-Watson/
A wiseman can learn from a fool much more than a fool can ever learn from a
wiseman. — http://en.wikiquote.org/wiki/Cato_the_Elder
Please reply to list if it's a mailing list post - http://shlom.in/reply .
This bug report was last modified 8 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.