且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用SED查找并用“ /”替换URL字符串。目标字符串中的字符?

更新时间:2022-01-29 22:37:38

/ 不是中的 分隔符sed 命令,它只是可能的命令之一。对于此示例,例如,可以使用代替,因为它与字符串不冲突;

/ is not the delimiter in sed commands, it's just one of the possible ones. For this example, you can for example use , instead since it does not conflict with your strings;

echo 'I think http://www.find.com/page is my favorite' | 
    sed 's,http://www.find.com/page,http://www.replace.com/page,g'