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萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章