How to do max-depth search in ack and grep?
You can couple find with the -exec argument. example:
find . -maxdepth 1 -exec grep foo {} \;
This can be scaled, i.e. -maxdepth 2
Use -n
for no-recurse
:
$ ack -n foo
grep
is not recursive by default, and you should use the -r
flag only if you want a recursive search.
You can search the current directory with grep
as follows:
$ grep -- foo *