I want to search multiple patterns
in a directory
containing recursive directories
and files
.
I know command for
For ag
, as of verion 0.19.2 the default is to search in directories and files recursively.
To search for multiple patterns, you can use similiar syntax as ack
ag 'pattern1|pattern2'
will search for both pattern1
and pattern2
.
In case you don't want to search recursively, you can set the search depth to 1 by the switch --depth NUM
Therefore,
ag 'pattern1|pattern2' --depth 1
will only search in the current directory for both patterns.