[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed question



On Friday, December 6, 2019 6:06:10 PM CET, songbird wrote:

result=`echo "summary: \"\"" | sed -e "s/^summary: .*$/summary: \"${old_summary}\"/"`

of course this doesn't work. since you use '/' (slash) as delimiter in the sed expression, the slash in $old_summary is interpreted as the delimiter, and the rest (everything after the third slash doesn't make any sense to sed.

in this case, you have to escape all slashes in $old_summary to allow sed to do what you want.

try this:

result=`echo "summary: \"\"" | sed -e "s/^summary: .*$/summary: \"${old_summary//\//\\\/}\"/"`

greetings...


Reply to: