linux grep

新建一下文件 yp.conf

# domain NISDOMAIN server 192.168.0.254
cleantha
cleantha
cleantha
cleantha
cleantha
cleantha
cleantha
cleantha
cleantha
cleantha
# domain NISDOMAIN server 192.168.0.254 cleantha


然后

cat yp.conf | grep '^# d'

输出

# domain NISDOMAIN server 192.168.0.254
# domain NISDOMAIN server 192.168.0.254 cleantha


cat 本身是查看linux下的文本 用管道符链接上一个正则匹配后相当是过滤了文本中的信息再显示

你可能感兴趣的:(linux grep)