2011-02-03 83 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)。