例如,a.txt文件的内容如下:
test1
test2
用sed -i s/$/hello/g a.txt可以在a.txt结尾添加hello字符串。a.txt结果如下:
test1hello
test2hello
用sed -i s/^/hello/g a.txt可以在a.txt开头添加hello字符串。a.txt结果如下:
hellotest1
hellotest2
例如,a.txt文件的内容如下:
test1
test2
用sed -i s/$/hello/g a.txt可以在a.txt结尾添加hello字符串。a.txt结果如下:
test1hello
test2hello
用sed -i s/^/hello/g a.txt可以在a.txt开头添加hello字符串。a.txt结果如下:
hellotest1
hellotest2