我是一名perl新手,我需要一个
的命令答案 0 :(得分:0)
这是一个在命令行上输入perl one-liner的解决方案。在命令行中添加 -i 以编辑文件或使用> 指向新文件。使用-i或-i.old I.e. perl -i -pe ...您可以根据需要提供尽可能多的文件 - 使用$ ARGV重置第一行的位置,所有这些文件都会对第一行进行适当修改。
tcsh 55> cat test1.in
this is test line one there is a "c" at character position 71 ........c.... this is also a test line there is a "c" at character position 71 .....c....
tcsh 56> perl -pe 'BEGIN{$a="a";$h{$a++}=++$i while ($i<10)} if ($.==1){s/^(.{70})([a-j])(.*)/sprintf("%s%d%s",$1,$h{$2},$3)/e}' test.in
this is test line one there is a "c" at character position 71 ........3.... this is also a test line there is a "c" at character position 71 .....c....