Linuxfind grep的問題 - LinuxMia · 2019-10-04Table of ContentsPostCommentsRelated Postsfind /aaa/ -name "bbb.file" -exec grep "ccc" {} \ ; 請問收尋不到ccc該如何印出"no match"呢? google過知道grep有回傳值但不知道該如何抓 謝謝大大 -- LinuxAll CommentsBlanche2019-10-05-exec <grep片語> \; | tee 1>&2 | [ `wc -c`='0' ] &&echo No Match以上省略 -exec之前Linda2019-10-08發現還是不對,請忽略Madame2019-10-10grep "ccc" `find /aaa/ -name "bbb.file"`Jake2019-10-12grep -lv 可列出搜不到的檔案Steve2019-10-14其實 -lv 也不對 XD, -c 再加其他判斷應該就可以George2019-10-18找不到參數就自己刻一個... 把 -exec 換成Vanessa2019-10-20| xargs grep c; if [ $? -eq 1 ]; then echo "xx";fi推文字數限制... 把上面的 xx 換成 no matchIsabella2019-10-25xagrs 的參數再自己調一下Elma2019-10-29-exec含後面換掉,改成|xargs grep "ccc" ||echo "字串"Carol2019-11-03整串變成: find /aaa/ -name "bbb.file" |xargsgrep "ccc" || echo "no match"Jake2019-11-05find /aaa/ -name "bbb.file" -exec grep "ccc" {} \;||echo "no match"Todd Johnson2019-11-06自己接一下Emma2019-11-09find /aaa/ -name "bbb.file" \( -exec grep "ccc" {}\; -o -exec echo No match \; \)Necoo2019-11-12樓上正解, -exec 其實是也判斷式Queena2019-11-13不要bbb的話最後加上|grep -v "bbb"就好,Tracy2019-11-16我以為你只要no matchSandy2019-11-16中括號可能要跳脫, \{\} 或 '{}'Related Posts可支援筆電,平板模式的OSUbuntu Studio如何提高CPU/GPU使用率rhce課程Ubuntu 16.04關機要多久如何遠端設定主機收發郵件功能
All Comments