Perl的:加字符开头一行 [英] Perl: add character to begin of a line
本文介绍了Perl的:加字符开头一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要一个字符添加到每一行的一个文本文件中开始了。有没有什么简单的解决方案?
I want to add a " character to the begin of every line in a text file. Is there any simple solution?
推荐答案
的perl -p -e'S / ^ //MYFILE
应该这样做!
$ cat myfile
0
1
2
3
4
5
6
7
8
9
10
$ perl -p -e 's/^/"/' myfile
"0
"1
"2
"3
"4
"5
"6
"7
"8
"9
"10
这篇关于Perl的:加字符开头一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文