sed替换行首和行尾
sed -i 's/^/HEAD&/g' test.file
sed -i 's/$/&TAIL/g' test.fileabcd
ab cdHEADabcdTAIL
HEADab cdTAILsed '/./{s/^/HEAD&/;s/$/&TAIL/}' test.file参考
Last updated
sed -i 's/^/HEAD&/g' test.file
sed -i 's/$/&TAIL/g' test.fileabcd
ab cdHEADabcdTAIL
HEADab cdTAILsed '/./{s/^/HEAD&/;s/$/&TAIL/}' test.fileLast updated