命令格式:
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