find, xargs, gep -- multiple words in files
Ubuntu user technical support, not for general discussions
littlergirl at gmail.com
Tue Feb 3 19:07:46 UTC 2026
Hey there,
bruce wrote:
> I'm trying to use 'find', 'grep', 'xargs' to find multiple "words"
> in a given line/file
>
> find /foo/projects -name "*.*" | xargs grep -i "review"
>
> will find the files with "review".. no prob...
>
> but...
>
> trying different cmds using the above as a base, haven't really
> worked. --And, I'm not apparently finding the example with the
> (find, xargs, grep) for finding files with multiple words.
I might be misunderstanding what you're looking for, but either of
these commands will find all lines that contain foo or bar or baz in
any file in the current directory:
grep -E "foo|bar|baz" *.*
grep -e "foo" -e "bar" -e "baz" *.*
You could customize them to suit the locations you'd like to
search and the files you'd like the search to be done in and either
use them alone or bolt them onto your find command above in place
of the grep command you've got there. Note that I haven't tested the
latter option.
--
Little Girl
There is no spoon.
More information about the ubuntu-users
mailing list