gmgitx / BLOG_natural_science

精于勤,荒于嬉;行成于思,毁于随。 韩愈
GNU General Public License v3.0
0 stars 0 forks source link

sed #18

Open gmgitx opened 5 years ago

gmgitx commented 5 years ago

18

gmgitx commented 5 years ago

From

例如:把txt文件中包含test行的行尾添加 ‘000’

sed -i '/test/ s/$/000/'

gmgitx commented 5 years ago

From

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

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

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

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