sed命令给文本文件的每行的行首或者行尾添加文字

在每行的头添加字符,比如"HEAD",命令如下:

sed 's/^/HEAD&/g' test.file

在每行的行尾添加字符,比如“TAIL”,命令如下:

sed 's/$/&TAIL/g' test.file

参考

    1. linux shell 用sed命令在文本的行尾或行首添加字符 http://www.cnblogs.com/aaronwxb/archive/2011/08/19/2145364.html

posted @ 2015-01-25 00:12  liqipeng  阅读(1673)  评论(0编辑  收藏  举报