grep [options] PATTERN [FILE...] grep [options] [-e PATTERN | -f FILE] [FILE...]
printenv <html> | </html> grep lib | print a list of environment variables that contain “lib” |
grep -e foo -R -n . | search from current directory and below, inside of files for “foo”, and print a list of file paths, line numbers, and lines that match | |
grep -e foo -R -l . | search from current directory and below, inside of files for “foo”, and only print a list of files that match | |
grep -i foo -R -l . | same as previous, but case insensitive “foo” (foo, Foo, FOO, etc…) |
grep -R -n -iE 'todo|fixme' . | grep -v -E '\.svn|\.log'
grep -U -R -P '\x0d' * or list files only (this example uses octal carriage return) grep -U -R -l -P '\015' *