grep -E:相当于 egrep,支持扩展正则。-A:匹配过滤的内容以及下面的行,例如下面5行为-A5。-B:匹配过滤的内容以及上面的行,例如上面5行为-B5。-C:匹配过滤的内容以及上下的行,例如上下5行为-C5。-c:统计出现了多少行,类似wc -l。-v:显示除过滤行以外的其他行内容。-n:显示行号。-i:忽略大小写。-w:精确过滤。 精确过滤的几种方法(只匹配 abc): echo ab…
基础正则 BRE ^ 以…开头的行 $ grep '^or' demo1.txt or 3.6 kilobytes of data transferred. $ 以…结尾的行 $ grep 'bytes$' demo1.txt so a two-page letter would be 3600 bytes One pixel in a photo takes 3 bytes A 4K photo…