I want to search multiple patterns in a directory containing recursive directories and files.
I know command for
This should be enough:
ack -R 'string1|string2'
As -R is the default, you can omit it:
ack 'string1|string2'
From man ack:
-r, -R, --recurse
Recurse into sub-directories. This is the default and just here for compatibility with grep. You can also use it for turning --no-recurse off.
If you want to get the pattern from a file, say /path/to/patterns.file, you can use:
ack "$(cat /path/to/patterns.file)"
or equivallently:
ack "$(< /path/to/patterns.file)"
I cannot find an exact equivalent to grep -f.