I would like to restrict sed in a way where it will only work in between two tags (XML format). What I need to do is replace specific strings in between those two tags with specific words. The only problem is that outside of those two tags there are occurences of those specific strings. Result: A messed up XML format.
Example files (Only parts):
Original SVG: http://pastebin.com/mZrgee5p Colours CSV: http://pastebin.com/bqTjnQj4
Goal: Change out every occurence of a id="state name" in the svg with id="state name" style="fill:Colour as found in the CSV;". Yet, this should only happen in between the g tags.
Current sed :
sed -i "s/$deel1/$deel1\" style=\"fill:<$deel2>;/g" TijdelijkBestand.svg
where $deel1 = State name, $deel2 == Colour, TijdelijkBestand.svg == Working file.
So as an example:
<path id="AS"
should turn into this
<path id="AS" style="fill:<black>;"
But only in between the g tags.
No comments:
Post a Comment