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