我看到了最奇怪的结果,希望有人能解释给我听。在
因此,我使用find命令来定位.log类型的所有文件,并将该命令的结果管道化到python脚本中。只有find命令的第一个结果被管道传输到xargs,或者xargs接收所有结果并将它们作为字符串传递给python脚本。在
示例:
# Find returns 3 .log files
find . -name "*.log"
file1.log
file2.log
file3.log
# xargs only runs the python script for first found file (or all 3 are being piped to script as a single string, and only first result is read in)
find . -name "*.log" | xargs python myscript.py -infile
Success: parsed file1.log
我想要的是对找到的3个文件运行python脚本。在
^{pr2}$
目前没有回答
相关问题 更多 >
编程相关推荐