Chris Schammert
Github Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

đŸ’ģ Grep


Recursive matching

Recursive: check subdirectories

  • grep -r term4search /dir

Exclude Match

  • grep -v term2exclude /dir/file

Match and match

  • egrep -w 'term1|term2' /dir/file

Ignore case

  • grep -i searchterm /dir/file

String multiple matches

  • grep -e term1 -e term2 -e term3 /dir/file

Search via extensions

.txt, .mp3, .svg, .sh, .bash, .conf, etc.

  • grep -e term1 -e term2 /dir/*.txt