2017-01-19 8 views

答えて

4

perlの起動方法に関するドキュメントは、perlrunのマニュアルページにあります。複数のファイルを変更したい場合は

perl -i~ -pe'...' file [file [...]] # Modifies named file(s) in place with backup. 
perl -i -pe'...' file [file [...]] # Modifies named file(s) in place without backup. 
perl  -pe'...' file.in >file.out # Reads from named file(s), outputs to STDOUT. 
perl  -pe'...' <file.in >file.out # Reads from STDIN, outputs to STDOUT. 

は、次のいずれかを使用することができます。

find ... -exec perl -i~ -pe'...' {} +  # GNU find required. 
find ... | xargs perl -i~ -pe'...'  # Doesn't support newlines in file names. 
find ... -print0 | xargs -0 perl -i~ -pe'...' 

注:一部のワンライナーではなく-p-nと明示的なプリントを使用します。上記のすべてがこれらにも当てはまります。

関連する問題