指定要处理到Perl一线文件 [英] Specifying file to process to Perl one-liner
本文介绍了指定要处理到Perl一线文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了Perl一线纸.它具有以下形式:
I was given a Perl one-liner. It has the following form:
perl -pe'...'
如何指定要处理到程序的文件?
How do I specify the file to process to the program?
推荐答案
If you wanted to modify multiple files, you could use any of the following:
find ... -exec perl -pe'...' -i~ {} + # GNU find required.
find ... | xargs -r perl -pe'...' -i~ # Doesn't support newlines in file names.
find ... -print0 | xargs -r0 perl -pe'...' -i~
注意:一些单线使用-n
和显式打印而不是-p
.以上所有内容同样适用于这些.
Note: Some one-liners use -n
and explicit prints instead of -p
. All of the above applies to these as well.
这篇关于指定要处理到Perl一线文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文