Search /etc/passwd for boo user:
You can search recursively i.e. read all files under each directory for a string "boo":
You can use -v option to print inverts the match; that is, it matches only those lines that do not contain the given word. For example print all line that do not contain the word bar:
grep boo /etc/passwdYou can force grep to ignore word case i.e match boo, Boo, BOO and all other combination with -i option:
grep -i "boo" /etc/passwdUse grep recursively
You can search recursively i.e. read all files under each directory for a string "boo":
grep -r "boo" /etc/You can search for a string boo irrespective of word case and recursive:
grep -ir "boo" /etc/When you search for boo, grep will match fooboo, boo123, etc. You can force grep to select only those lines containing matches that form whole words i.e. match only boo word:
grep -w "boo" /etc/Grep invert match
You can use -v option to print inverts the match; that is, it matches only those lines that do not contain the given word. For example print all line that do not contain the word bar:
grep -v boo /etc/
Comments
Post a Comment