grep
Links
ack is a tool like grep aimed at programmers with large trees of source code.
Usage
unix search file content including subfolders using grep:
grep -r "my search term" *
Additionally, you can include/exclude the files that are searched:
grep -r --include=*.py "my search term" *
…this example excludes any file where the filename contains carpal:
grep -r --exclude=*carpal* vim *
The following returns all the lines that contain a string matching
the expression foo
in the file file
:
grep foo file
To invert the search (this example will list all files which do not have a
.pyc
extension):
grep -v .pyc
To list only the file names:
grep -r -l "apple" .
wc
See wc - Word Count.