grep正则表达式操作命令(4)

[root@localhost ~]# grep -A 1 "123" /tmp/test/b
12312131231 
THIS  IS  A  "TEST"
[root@localhost ~]# grep -B 1 "123" /tmp/test/b
q
12312131231
[root@localhost ~]# grep -C 1 "123" /tmp/test/b
q
12312131231 
THIS  IS  A  "TEST"
[root@localhost ~]# grep -c  "ab" /tmp/test/b
3
[root@localhost ~]# grep -e  "ab" -e "ef" /tmp/test/b
aaabbbccc
abcabc
abcdefg
[root@localhost ~]# grep -i "is" /tmp/test/b
THIS  IS  A  "TEST"
[root@localhost ~]# grep -o "IS" /tmp/test/b
IS
IS
[root@localhost ~]# grep -q "IS" /tmp/test/b
[root@localhost ~]# grep -v "IS" /tmp/test/b
aaabbbccc
abcabc
abcdefg
s
r
q
12312131231

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/12922.html