查阅文件技巧

一、打印除匹配行之外的其它行,使用grep -v

打印行首不包含$或#的注释行:cat file| grep -v ^$ | grep -v ^#

打印某文本文件行首不包含$或#的注释行:egrep -v "^#|^$" nginx.conf.default

知识点:

1、行首-------^

2、正则表达式“或”-------|

原文地址:https://www.cnblogs.com/victorfrost/p/8507595.html