1、文件外替换,运行sed命令
sed -i "s/欲被替换的字符串/被换成的字符串/g" 替换的文本
sed -i "s/hello/thank/g" replace.sh
2、若在shell脚本下。输入:s/hello/thank/g则为当前行所有hello字符串变为thank字符串
1、文件外替换,运行sed命令
sed -i "s/欲被替换的字符串/被换成的字符串/g" 替换的文本
sed -i "s/hello/thank/g" replace.sh
2、若在shell脚本下。输入:s/hello/thank/g则为当前行所有hello字符串变为thank字符串