www.evidhyashala.com provides free free mock test , free online exam , online exam free test series , online exam free , Online Test Exam Series , free exam papers past papers , online exam form ,Online Test Series for Exam Prep. Free Mock Tests - for All govt jobs. Bank PO, Clerk, SSC CGL, CHSL, JE, GATE, Insurance, Railways, IBPS RRB, SBI, RBI, IPPB, BSNL TTA

Sponser Link

know more info pls click here

grep Unix OS Command/r&d22112011

grep (is beautiful)

  •  Search through stdin for things
  •  Sends to stdout lines matched lines
            $ grep tacos

                this   line   has   tacos
                this   line    has   tacos
                this   line   dosen't
                more  tacos
                more  tacos 

  •  You can do the same in awk with
              $ awk '/tacos/{print $0}'
             Ex1.  $ grep B2  

             Ex2. $ grep A4
             Ex3.$ grep C3

  • -B prints lines before match
  •  -A prints lines after each match
  •  -C prints the lines before and after
  •  -i case insenstive search
  •  -v prints lines with no match
  •  -c prints just number of matches
  •  --color highlights matches


  •  Fancy regular expressions: -E
  •  Example: Match IP range from 172.22.21.1 to 172.22.21.35:
Example:

$ grep E   '172\.22\.21\.([19]|( 1[09]| 2[09]| 3[05])) ' hosts.txt


xargs (to the rescue)
Example: run cvs update in all subfolders:

find . type  d | xargs i t sh c \ 'cd {};cvs update' 

0 comments:

Popular Posts