[英]Locate files then Grep their contents
locate 'filename' | grep 'pattern'
grep'pattern locate 'filename' | grep 'pattern'
找到文件,然后抓取它們的文件名。 我想改寫文件的內容。
您必須將文件名作為參數傳遞給grep:
grep 'pattern' $(locate 'filename')
( $(...)
將評估命令並返回其stdoutput)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.