Saturday, April 28, 2007

用sed为文本快速添加行首行尾

比如说有这样一个文件:


This is line 1
This is line 2
...


要把它置换为


header: This is line 1 footer
header: This is line 2 footer
...


可使用sed:
sed 's/^\(.*\)$/header: \1 footer/' sed.txt

No comments: