grep sed awk三剑客详解

find

学这三个命令之前,还是要先来个开胃菜,学一下find命令:

find /etc/ -name *.txt   # 查找etc下面所有的txt文件
find /etc/ -name feed -type f  # 查找feed文件,-type 后面跟d ,查找feed目录
find tests/ -name uu -exec cp {} tests/gg \;  # -exec效果更强大,直接找到uu,并且复制到后面的路径为gg,后面可以加各种操作,这里只是示范cp

grep

grep -v "#" /etc/xx.conf | grep -v "^$"   # -v过滤掉 以“#”开头的行 -v "^$" 过滤掉空行

发布了138 篇原创文章 · 获赞 42 · 访问量 9万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章