输出匹配项:grep

来源:互联网 发布:dd3000软件 编辑:程序博客网 时间:2024/06/05 04:30

命令格式:

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

会得到如下结果:

bunzip2bzip2gunzipgzipunzipzipzipcloakzipgrepzipinfozipnotezipsplit
原创粉丝点击