0

To search in Linux for a file that contains a string, one would usually use:

grep "search string" *

But what if you instead want to pass a file (such as mySearchString.txt, which obviously would contain the string "search string" - without the double quotes... unless they or single quotes are required?) to grep for it to use to search for that string?

grep <mySearchString.txt *

Doesn't seem to work...

2

1 Answer 1

1

man grep:

-f file
--file=file

Obtain patterns from file, one per line. If this option is used multiple times or is combined with the -e (--regexp) option, search for all patterns given. The empty file contains zero patterns, and therefore matches nothing. (-f is specified by POSIX.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.