-E 按Extended规范进行匹配

--color 标记匹配颜色

-i 忽略大小写匹配

[fbl@www test6_26]$ echo "hello" | grep -i --color 'HELLO'hello

-q 安静匹配 即不输出内容

[fbl@www test6_26]$ echo "hello" | grep -q --color 'hello'[fbl@www test6_26]$ echo $?0

-o 只输出匹配到的部分

[fbl@www test6_26]$ echo "hello" | grep -E -o --color 'hell*'hell

-w 只显示全字符合的lie

[fbl@www test6_26]$ cat file1hellohelloohell[fbl@www test6_26]$ cat file1 | grep -E --color 'hell'hellohelloohell[fbl@www test6_26]$ cat file1 | grep -wE --color 'hell'hell

[fbl@www test6_26]$ cat file

apple

bahyude

nue

111123

88888

hello

change

brance

6666

[fbl@www test6_26]$ cat file | grep -E --color '^[a-z]{1,}[a-z]$'applebahyudenuehellochangebrance

-c 输出匹配到的列数

[fbl@www test6_26]$ cat file | grep -cE --color '^[a-z]{1,}[a-z]$'6

-n 显示匹配到的列及列号

[fbl@www test6_26]$ cat file | grep -nE --color '^[a-z]{1,}[a-z]$'1:apple2:bahyude3:nue6:hello7:change8:brance

-v 显示不匹配的列

[fbl@www test6_26]$ cat file | grep -vE --color '^[a-z]{1,}[a-z]$'111123888886666

-a 偏移匹配

[fbl@www test6_26]$ cat file | grep -a2 --color 'hello'11112388888hellochangebrance