Chapter 13 linux三剑客
13.1 grep
globally search a regular expression and print
grep [选项] 搜索内容 文件(可指定多个)
- grep apple fruitlist.txt
- grep apple fruitlist1.txt fruitlist2.txt
- grep apple *.txt
- grep -i apple *.txt :忽略大小写
- grep -n root passwd :显示行号
- grep -v test *test* :查找名称带test的文件中不含test的行
- grep -e apple -e orange fruitlist.txt :多个搜索项的逻辑or关系
- grep -E “正则表达式” file :使用extended-regexp