GREP

xiaoxiao2021-03-06  54

1) $ grep -n '^ South' DataFile

3: Southwest SW Lewis Dalsass 2.7

2) $ grep -i 'Pat' DataFile

Pat Huang Yuxiao

PS: The -i Option Turns Off Case Sensitivity (Nomatter LowerCase Or Uppercase).

3) $ GREP -V 'Li' Datefile

PS: The -v Option Prints All Lines Not Contain The Pattern 'Li'.

4) $ GREP -L 'SE' *

PS: The --l Option Only Prints The FileNames Where The Pattern is found.

5) $ grep -c 'West' DataFile

PS: The -c Option Causes Grep To Print How much line Which

Matches the pattern. (but if the pattern matches three Times in a line, IT

ONLY Count One Time)

6) $ grep -w 'north' DataFile

Ps: The -w Option Causees Grep To Find The Pattern Only IT IS A Word, Not

Part of Word. Only the line contain The Word North Is Printed, Not

Northwest.

Summary: grep can use combine with regular expression, so it's a powerful

Tool of UNIX.

GREP [-V] [-l] [-w] [-c] [-] [] [] [] [] []

转载请注明原文地址:https://www.9cbs.com/read-115243.html

New Post(0)