Thursday, October 30, 2014

Thursday, October 2, 2014

grep in a bunch of files

I always have to look this up so I'm posting a note to myself here. To grep through all the files in a directory, recursively, and only get back a list of the files containing the string, do

$ grep -lr "searchterm" location

E.g.:

$ grep -lr "Enum" /var/log/rtr/pops

$ grep -lr "receipt" .

Found this in this blog.