packageurl="http://192.168.0.112" packageurl_line=`grep -n "packageurl" ${file} | head -1 | cut -d ":" -f 1;` sed -ig "${packageurl_line},${packageurl_line}s/\"packageurl\".*/\"packageurl\":\"${packageurl}\",/g" ${file}
as code, throws error, because packageurl contain "/", how resolve problem without modify packageurl?
sed: 1: "2,2s/"packageurl":.*/"p ...": bad flag in substitute command: '/'
you don't need use /
sed s
delimiter. it's happy characters:
sed 's,bob,tony,'
for example.
Comments
Post a Comment