输出匹配项:grep

命令格式:

grep pattern [file...]

When grep encounters a “pattern” in the file, it prints out the lines containing it.

也就是说,grep 命令的功能是,如果 file 中存在于 pattern 匹配的项,则输出。举例说明:

ls /bin /usr/bin | sort | uniq | grep zip

会得到如下结果:

bunzip2
bzip2
gunzip
gzip
unzip
zip
zipcloak
zipgrep
zipinfo
zipnote
zipsplit
posted @ 2017-05-29 09:44  2021年的顺遂平安君  阅读(52)  评论(0编辑  收藏  举报