Sample Header Ad - 728x90

Replace an attribute value with another value in SVG

0 votes
1 answer
539 views
I have a directory that contains multiple SVG files. What I am trying to do is replace the height="2500" (value of height can be any integer) with height="{{ include.height }}". Can anyone tell me what I am doing wrong?
find_string="height=\"\d+\""
replace_string="height=\"{{ include.height }}\""
for i in . -type f -name "*.svg");
do
    if grep -q "${find_string}" $i
    then
        sed -i -r "s/${find_string}/${replace_string}/" $i
    fi
done
Asked by Ravgeet (1 rep)
Jun 29, 2020, 10:06 AM
Last activity: Jun 30, 2020, 12:42 PM