find, xargs, gep -- multiple words in files

Ubuntu user technical support, not for general discussions littlergirl at gmail.com
Tue Feb 3 19:53:49 UTC 2026


Hey there,

bruce wrote:
 
> right,  but I'm looking to find 'both' words. using find  xargs,
> grep.  I think I may have found a soln.
>
> But, if u have one, I'm interested in seeing it.

My mistake for wording the description badly. Either of those
commands will find all lines containing any of the search terms.

Also, I noticed that Nils' suggestion specified the directory the way
your original example did and that you had used the -i switch in your
example command, so I modified my two to do both of those:

grep -rEi "foo|bar|baz" /foo/projects
grep -rei "foo" -e "bar" -e "baz" /foo/projects

Note that either of those will check all files even though *.* isn't
specified.

-- 
Little Girl

There is no spoon.



More information about the ubuntu-users mailing list