在 Linux 中有一个名为 test 的文件,内容如下:
Apple appearance is very cute. Apple color is uniform, mostly in the red. My favorite fruit is an apple. We should eat apple everyday.如何在所有 Apple 字符串后添加一个字符 's' ,并对修改过的每一行行首添加字符 '+' ()
Apple appearance is very cute. Apple color is uniform, mostly in the red. My favorite fruit is an apple. We should eat apple everyday.如何在所有 Apple 字符串后添加一个字符 's' ,并对修改过的每一行行首添加字符 '+' ()
sed -i '/Apple/{s//&s/;s/$/+/}' testsed -i '/Apple/{s//&s/;s/^/+/}' testsed -i '/Apple/{s//Apple/;s/^/+/}' test
sed -i '/Apple/{s/&/s/;s/^/+/}' test
这道题你会答吗?花几分钟告诉大家答案吧!