使用grep 带Ev参数,个人对于理解就是,E参数表示可以使用正则表达式,v参数表示反转正则表达式的匹配,此参数的官方解释如下
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (see below).
将模式解释为扩展的正则表达式(参见下面)。
-e PATTERN, --regexp=PATTERN
Use PATTERN as the pattern; useful to protect patterns beginning
with -.
使用模式作为模式;有用的保护模式开始
-V, --version
Print the version number of grep to standard error. This ver-
sion number should be included in all bug reports (see below).
将grep的版本号打印到标准错误。这版本所有的bug报告中都应该包含sion号(见下面)。
-v, --invert-match
Invert the sense of matching, to select non-matching lines.
反转匹配的意义,来选择不匹配的行。
[ops@VM217 etc]$ cat zabbix_server.conf | grep -Ev '#|^$' 结果如下
[ops@VM217 etc]$ cat zabbix_server.conf | grep -Ev '#|^$'
LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix@ruifu123
DBSocket=/data/mysql/run/mysql.sock
StartPollers=500
StartIPMIPollers=30
StartPollersUnreachable=50
StartTrappers=30
StartDiscoverers=6
HousekeepingFrequency=12
MaxHousekeeperDelete=1000000
CacheSize=2G
StartDBSyncers=20
HistoryCacheSize=512M
HistoryIndexCacheSize=128M
TrendCacheSize=256M
ValueCacheSize=512M
Timeout=30
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts
FpingLocation=/usr/local/fping/sbin/fping
LogSlowQueries=3000
StartProxyPollers=20
ProxyConfigFrequency=30
ProxyDataFrequency=1
User=daemon