1
我有幾行文字如下之間遞增的數字換行:我想創建一個包含文本的每一行
The cat and the mouse
Were in the house
They spotted some grouse
我希望把每一行文本之間的新行後的遞增數「>」,使其看起來像這樣
>1
The cat and the mouse
>2
Were in the house
>3
They spotted some grouse
我想這樣做在perl如果可能的話是我能在Mac上運行它。誰能幫忙?
太棒了。那麼我如何將結果保存到txt文件而不是在終端上打印? – 2014-09-28 14:59:13
@ user3632206你可以通過添加'> file2'將文件重定向到文件或者在編輯'perl -i -pe ..' – 2014-09-28 15:00:51
當投下正確答案時請發表評論。 – 2014-09-28 18:20:16