1.grep & egrep
[zhouhh@etel ~]$ vi test1
line 1
hello, I'm line 2
line 3
this is line 4
保存
[zhouhh@etel ~]$ cat test1 grep hello
hello, I'm line 2
[zhouhh@etel ~]$ grep hello <>
grep不支持+,故不显示结果
[zhouhh@etel ~]$ grep '^.+line [0-9]$' test1
[zhouhh@etel ~]$ egrep '^.+line [0-9]$' test1
hello, I'm line 2
this is line 4
使用-v反转输出
[zhouhh@etel ~]$ grep '^line' test1
line 1
line 3
[zhouhh@etel ~]$ grep -v '^line' test1
hello, I'm line 2
this is line 4
没有评论:
发表评论