grep的过滤使用
已知文件test里有以下内容
[root@yangwenbo /]# cat test
yuni
yunwei
YUNWEI
YWEI
yunjijsuan
yunsuan
YUNJISUAN
1.只显示匹配的内容
[root@yangwenbo /]# cat test | grep -o yunwei
yunwei
2.忽略大小写
[root@yangwenbo /]# cat test | grep -i yunwei
yunwei
YUNWEI
3.目标排序
[root@yangwenbo /]# cat test | grep -in yunwei
2:yunwei
3:YUNWEI
4.精确匹配
4.1输入错误
[root@yangwenbo /]# cat test | grep -w yunwe
[root@yangwenbo /]#
4.2正确输入
[root@yangwenbo /]# cat test | grep -w yunwei
yunwei
5.排除某个文件输出其它
[root@yangwenbo /]# cat test | grep -v yunwei
yuni
YUNWEI
YWEI
yunjijsuan
yunsuan
YUNJISUAN