-v
是grep排除的参数,例:查询不包含字母abc的行,例如cat test.txt |grep -v 'abc'
^
代表行首,$
代表行尾。^$
是空行的意思^#
表示首字母为#
的行,linux里的文件,#
号开头一般都是注释内容grep -v '^$' /data/soft/kafka_2.11-2.4.1/config/server.properties | grep -v '^#'
查询server.properties
文件,但是不包含空行和注释行grep -v '^$' config/server.properties |grep '='
查询server.properties
文件,包含等号的行
linux使用grep过滤行
最新推荐文章于 2024-06-07 11:07:35 发布