2011-02-03 85 views
1

這是什麼意思,還有什麼時候管入wc是什麼?我知道它最終計數ABC的數量出現在文件的文件名,但不知道該期權的並還管WC平均linux命令grep -is「abc」文件名| wc -l

linux command grep -is "abc" filename|wc -l 

輸出

47 
+3

linux命令man grep – tawman 2011-02-03 17:03:44

+1

男人會在一分鐘之內讓你在那裏。 – 2011-02-03 17:06:32

回答

1

man頁有你想知道關於grep的選項的一切:

-s, --no-messages 
      Suppress error messages about nonexistent or unreadable files. 
      Portability note: unlike GNU grep, traditional grep did not con- 
      form to POSIX.2, because traditional grep lacked a -q option and 
      its -s option behaved like GNU grep's -q option. Shell scripts 
      intended to be portable to traditional grep should avoid both -q 
      and -s and should redirect output to /dev/null instead. 

的菸斗,wc -l是什麼讓你的字符串「abc」多少行上出現的次數。這不一定是字符串出現在該文件中,因爲擁有多個分身一行將被算作只有1次

0

grep的手冊頁說:

-s, --no-messages   suppress error messages 

grep返回其中包含abc(不區分大小寫)的行。你管他們到wc得到一個行數。

2

-s表示「禁止關於不可讀文件的錯誤信息」,而指向wc的管道則表示「接收輸出並將其發送到wc -l命令」,以有效計算匹配的行數。你可以完成與-c選項的grep一樣:grep的-isc 「ABC」 文件名

0

man grep

-s, --no-messages 
      Suppress error messages about nonexistent or unreadable files. 

wc命令計數行,字和字符。用-l返回行數。

2

考慮的次數,

command_1 | command_2

管道的作用是,它需要輸出寫在它之前的命令(command_1 here),並將輸出提供給它後面的命令(此處爲command_2)。