[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: searching inside files with find, cat and grep as a oneliner ...



Albretch Mueller <lbrtchx@gmail.com> wrote:

>  I need to:
> ~
>  search for files using a pattern (say all files with a certain extension)
> ~
>  then search inside each of the found files for a word or regexp pattern
> ~
>  You could do this using find, cat and grep in a script, but I was
> wondering about how could you do it with a oneliner

http://www.athabascau.ca/html/depts/compserv/webunit/HOWTO/find.htm
Look down to "How to find a string in a selection of files".

http://en.wikipedia.org/wiki/Find
Look down to "Search for a string"

But the newer style is to pipe find into xargs:

http://blog.endpoint.com/2010/07/efficiency-of-find-exec-vs-find-xargs.html
http://www.sunmanagers.org/pipermail/summaries/2005-March/006255.html
http://www.unix.com/unix-dummies-questions-answers/19217-difference-between-xargs-exec.html


Reply to: