我正试图在远程服务器上找到包含特定文本的文件。如果有多个文件,它应该列出包含该文本的所有文件。使用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