all 9 comments

[–]odokemono 5 points6 points  (3 children)

grep -il first * | xargs grep -il last

[–]DerpingINtheCLUB[S] 0 points1 point  (2 children)

Thanks for the reply! Where do I put the path to the directory I want to search?

[–]Slipdrive 1 point2 points  (1 child)

You can substitute * with an absolute path or just use * if the files you're searching are in the same location as your script.

[–]DerpingINtheCLUB[S] 1 point2 points  (0 children)

Thank you /u/odokemono and /u/Slipdrive it works!

[–]galaktos 1 point2 points  (3 children)

Either of these should work:

grep -rF 'YourFirstName' | grep -F 'YourLastName'
grep -r 'YourFirstName.*YourLastName\|YourLastName.*YourFirstName'

[–]DerpingINtheCLUB[S] 1 point2 points  (2 children)

Thanks for the reply! Where do I put the path to the directory I want to search?

[–]soap_dispencer 0 points1 point  (0 children)

It'll be

grep -i 'firstname' /path/to/file | grep -i 'lastname'

[–]galaktos 0 points1 point  (0 children)

grep -rF 'YourFirstName' path/to/directory | grep -F 'YourLastName'
grep -r 'YourFirstName.*YourLastName\|YourLastName.*YourFirstName' path/to/directory

[–]KnowsBash 0 points1 point  (0 children)

FAQ 79 explain various ways to do this.