【发布时间】:2013-10-18 23:55:10
【问题描述】:
我正在尝试跟踪位于远程服务器目录中的所有文件,但用户在命令行中作为第三个参数输入的文件除外。为此,在将 tail 的输出定向到另一个文件时,我需要 grep 文件类型以避免混淆。
目录是/path/to/a/file,里面有两个文件,一个叫file.log,另一个叫file.out。我想 grep .out & .log
这是我的代码:
files=$(ssh host find /path/to/a/file -type f -name '^file')
for type in $($files | awk -F'.' '{print $2}') ; do
ssh host find . /path/to/a/file -type f ! -name "$3" | xargs 0 tail -n 20 > /destination/dir/host.$type 2>/dev/null
不幸的是,这些都不起作用,我不知道为什么。
【问题讨论】:
-
没关系,我修好了!!
-
如果你已经解决了,那么你应该删除这个问题;它对其他人没有用处