|
|
Penguins Unbound > Past Meetings > 20110730 - Bash Programming > Shell Scripting (or old *nix tools) > 04.3 - grep
04.3 - grepTable of contentsNo headers
grep is the ginsu knife of Unix! It slices, dices, and more!
grep is a tool to look through a stream (being a file, output from a program, or network traffic!) for a string. grep {-v | -i } String2SearchFor file_to_search
-v - all but the matching lines are liked (an opposite grep) -i - case insenstive search
grep uses regular express syntax to specify what to find. Some common regular extension syntax ^ - the begining of the line $ - the end of the line [ ] - match any one of the characters listed
Example grep in log files grep -i "^Jul 25 1[56]:" /var/log/kern.log This will get lines out of /var/log/kern.log from July 25 from 15-16 hours. |