Friday 12 January 2018

Negative matching using grep (match lines that do not contain foo)

itemprop="text">

I have been trying to work out the
syntax for this
command:




grep !
error_log | find /home/foo/public_html/ -mmin
-60


or



grep '[^error_log]' | find
/home/baumerf/public_html/ -mmin
-60


I need to see all
files that have been modified except for those named
error_log.




href="http://www.robelle.com/smugbook/regexpr.html" rel="noreferrer">I've read about
it here, but only found one not-regex
pattern.



Answer




grep -v is your
friend:



grep --help | grep invert





-v, --invert-match select non-matching
lines





Also
check out the related -L (the complement of
-l).





-L, --files-without-match only print FILE names containing no
match



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...