[Ilugc] One Day One Command

  • From: sbharathi@xxxxxxxxxxxxx (Bharathi S)
  • Date: Tue Jan 11 17:33:54 2005

One Day One Command :-
---------------------

grep -- (Global Regular Expression Print) 
         Print lines matching a pattern

Summary: 
`grep' searches the input files for lines containing a match to a
given pattern list. Grep has a no .of useful options and support 
regular expressions.

Examples:

$ grep -i bharathi Midas.txt -- Print the lines which contains string 
                                "bharathi" in the Midas.txt file

$ grep -v bharathi ILUGC.txt -- Print the line which is not the 
                                string "bharathi"

$ grep "^A" file -- Prints the line starting with A.

$ grep "Z$" file -- Prints the line with ending letter Z.

$ grep -c "Linux"  file -- Prints count of match. 

$ grep '^[012]' file -- Prints the line starting with 0/1/2

Read : info grep / egrep / fgrep

Bye :)
-- 
Bharathi S

Other related posts: