perl正则中"d"表示数字,+表示匹配一到多次(同vim)。
选项-a将二进制文件当成文本文件处理:
[root@centos7 ~]# grep -a online /usr/bin/ls %s online help: <%s> [root@centos7 ~]#
选项--exclude=GLOB和--include=GLOB分别表示排除和包含匹配GLOB的文件,GLOB表示通配符(find及xargs用法见基础命令介绍三):
[root@centos7 temp]# find . -type f | xargs grep --exclude=*.txt --include=test* bash ./test.sh:#!/bin/bash [root@centos7 temp]#
grep强大的过滤能力来自于各种选项以及正则表达式的配合,在今后的文章中还有更多的例子。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。










