|Welcome to the Monastery|
I need "Antigrep"by tphyahoo (Vicar)
|on Aug 15, 2006 at 17:52 UTC||Need Help??|
tphyahoo has asked for the
wisdom of the Perl Monks concerning the following question:
I'm doing cleanup on a large codebase.
It would be useful for me to identify files NOT containing certain patterns, eg files missing an initiation or configuration string, or that kind of thing.
I initially thought I could do this with grep -vl, but no dice. It doesn't work, because grep -vl compares line by line, so if any LINE doesn't contain the pattern, the file is flagged as not containing the pattern.
I tracked down a script called grepcat which supposedly does what I want (haven't tried it).
Seems a bit kludgy to me though, and a good candidate for doing in perl instead.
So, anybody got a quickie perl script to do the OPPOSITE of grep? I just want the filenames, not the non matching lines. Should work as follows
Alternatively, I should be able to do antigrep with
find | xargs antigrep.pl I'd really like to do this in a one-liner, but can't quite think how.