Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Common grep options and commands

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

-E matches according to Extended specification

-- color tag matching color

-I ignore case matching

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

-Q quiet match means no output

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

-o output only the parts that match

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

-w displays only the lie that matches the whole word

[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 Murz] {1,} [a Murz] $'applebahyudenuehellochangebrance

-c the number of columns to which the output matches

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

-n displays the matching column and column number

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

-v displays mismatched columns

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

-an offset matching

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report