1、從firefox中提取cookie
grep -oP '"url":"\K[^"]+' $(ls -t ~/.mozilla/firefox/*/sessionstore.js | sed q)?
2袍患、查找忽略大小寫
grep -i joe users.txt? ? ? ? ? ? ? ? # find joe, Joe, JOe, JOE, etc.
3册倒、正則匹配搜索
grep '^fred' /etc/passwd? ? ? ? ? ? # find 'fred', but only at the start of a line
grep '[FG]oo' *? ? ? ? ? ? ? ? ? ? ? # find Foo or Goo in all files in the current dir
grep '[0-9][0-9][0-9]' *? ? ? ? ? ? # find all lines in all files in the current dir with three numbers in a row
4症革、根據(jù)匹配關(guān)鍵字所在行
grep -B5 "the living" gettysburg-address.txt? ? ? ? # show all matches, and five lines before each match
grep -A10 "the living" gettysburg-address.txt? ? ? # show all matches, and ten lines after each match
grep -B5 -A5 "the living" gettysburg-address.txt? ? # five lines before and ten lines after
5晶默、