grep
Intro
grep
stands Global Regular Expression Print.
These notes assume we are using GNU coreutils tools. |
Basic Examples
Find for matches in dist or node_modules, etc:
$ grep --color -r -C 2 <pattern> ./dist
$ grep --color -r -C 2 <pattern> ./node_modules
Pipe to less
The option --color
implies --color=auto
by default.
To pipe to less
and have colors, use --color=always
and the -R
option to less
:
$ grep --color=always -rC2 <pattern> <directory> | less -R
|