我正試圖在遠程服務器上找到包含特定文本的文件。如果有多個文件,它應該列出包含該文本的所有文件。使用shell腳本在遠程計算機上查找帶有特定文本的文件
下面是我已經能夠做出的聲明,但不幸的是我在執行時收到錯誤消息。請指教。
命令:
sshpass -p abc123 ssh [email protected] find /root/Downloads/test/app/beta/System* -type f -mmin -60 | xargs grep -E "put"
錯誤消息:
grep: /root/Downloads/test/app/beta/SystemOut_qqq: No such file or directory
grep: /root/Downloads/test/app/beta/SystemOut_qwp: No such file or directory
很抱歉,但我得到了同樣的錯誤了。 grep:/ root/Downloads/test/app/beta/SystemOut_qqq:沒有這樣的文件或目錄 grep:/ root/Downloads/test/app/beta/SystemOut_qwp:沒有這樣的文件或目錄 – 2015-02-08 12:56:51
該命令正在查找新修改了兩個文件,但只有「SystemOut_qqq」中包含「put」文本。但是我得到的輸出是「沒有這樣的文件或目錄」以及上面的文件名。 – 2015-02-08 12:58:24
抱歉,粗心編輯導致錯誤引用,儘管我有自己的指示。現在試試。 – tripleee 2015-02-08 13:42:37