【发布时间】:2017-06-04 12:15:30
【问题描述】:
我有一个 grep 命令来查找需要替换值的文件。然后我有一个 perl one 行,需要在每个文件上执行以替换该文件中找到的变量。
如何将我的 grep 命令的结果通过管道传输到 perl one liner?
grep -Irc "/env/file1/" /env/scripts/ | cut -d':' -f1 | sort | uniq
/env/scripts/config/MainDocument.pl
/env/scripts/config/MainDocument.pl2
/env/scripts/config/MainDocument.pl2.bak
perl -p -i.bak -e 's{/env/file1/}{/env/file2/}g' /env/scripts/config/MainDocument.pl
感谢您的帮助。
【问题讨论】:
-
您能否就@millsofmn 提供的答案提供反馈?