1.grep -e 只能传递一个检索内容
grep -e pattern1 -e pattern2 filename
例如:
$ grep -e Tech -e Sales employee.txt
100 Thomas Manager Sales $5,000
200 Jason Developer Technology $5,500
300 Raj Sysadmin Technology $7,000
500 Randy Manager Sales $6,000
2.grep -E 可以传递多个内容 ,使用 | 来分割多个pattern,以此实现OR操作
grep -E 'pattern1|pattern2' filenam
例如:
$ grep -E 'Tech|Sales' employee.txt
100 Thomas Manager Sales $5,000
200 Jason Developer Technology $5,500
300 Raj Sysadmin Technology $7,000
500 Randy Manager Sales $6,000
---------------------
作者:一只考考拉
来源:CSDN
原文:https://blog.csdn.net/weixin_38629422/article/details/91801956
版权声明:本文为博主原创文章,转载请附上博文链接!
阅读(23010) | 评论(0) | 转发(0) |