linux中grep的用法

2021-09-25 12:38:59 字數 448 閱讀 2150

#grep [引數] 【匹配項】檔案a 檔案b……

grep -i the text.txt

#忽略the的大小寫在檔案中進行匹配

grep -v the text.txt

#在檔案中匹配不含the行

grep -n the text.txt

#在檔案中匹配the並且顯示行號

grep -c the text.txt

#統計匹配字串的行數

grep -h the text.txt words.txt

#查詢多個檔案,不顯示檔名

grep -l the text.txt words.txt

#查詢多個檔案時,輸出含匹配項的檔案

grep -w the text.txt words.txt

#完全匹配the 不包括串中含the

linux中grep的用法

過濾多個關鍵字 grep e root mysql etc passwd root 0 0 root root bin bash operator 11 0 operator root sbin nologin mysql 500 500 home mysql sbin nologin 排除多個關鍵...

Linux中grep命令的用法

1.作用 linux 系統中grep 命令是一種強大的文字搜尋工具,它能使用正規表示式搜尋文字,並把匹配的行列印出來。grep 全稱是global regular expression print 表示全域性正規表示式版本,它的使用許可權是所有使用者。2.格式 grep options 3.主要引數...

Linux中grep命令的用法

1.作用 linux系統中grep命令是一種強大的文字搜尋工具,它能使用正規表示式搜尋文字,並把匹 配的行列印出來。grep全稱是global regular expression print,表示全域性正規表示式版本,它的使用許可權是所有使用者。2.格式 grep options 3.主要引數 o...