You are not logged in.

#1 2009-08-14 08:19:06

jaem
Member
From: Canada
Registered: 2009-01-24
Posts: 23

Batch-process SVGs to remove paths

I have well over a hundred SVG files, from each of which I need to remove several path elements.  The paths are named the same in all of the files, and I know SVG is XML-based, so I would think it should be fairly simple (for some values of simple).  I've searched the Net, but I can't find anything already existing that's designed with this purpose in mind, and Inkscape doesn't support macros/batch jobs.  I'm not terribly familiar with XML, but if anyone can even point me in the right direction, that would be a start.
Full disclosure: the paths in these SVGs are intended to be watermarks, from a trial version of some conversion software, which I found after hours of trying to find a way to view DWF files on Linux.  If you think this is cheating, just don't help me. tongue


-Jeffery

Offline

#2 2009-08-14 08:37:18

Perry3D
Member
Registered: 2008-03-20
Posts: 553

Re: Batch-process SVGs to remove paths

Maybe a simple sed command could do your work.

sed 's/old/new/g' inputFile > outputFile

new is a regular expression.
http://en.wikipedia.org/wiki/Sed

Ok, thats not XML based.
You could try this: http://en.wikipedia.org/wiki/Xslt

Last edited by Perry3D (2009-08-14 08:38:32)

Offline

#3 2009-08-14 08:44:31

jaem
Member
From: Canada
Registered: 2009-01-24
Posts: 23

Re: Batch-process SVGs to remove paths

...wow, I feel like an idiot.  Not only did these folks not realize that watermarking a vector image is an annoyance at worst, but they also included the watermark code, very clearly, at the very beginning of the XML file.  I didnt think it would be that easy, so I didn't bother checking. >_<
Well, that solves that...


-Jeffery

Offline

#4 2009-08-14 08:47:46

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: Batch-process SVGs to remove paths

xmlstarlet can be used to edit xml files, too:

http://aur.archlinux.org/packages.php?ID=20101

Offline

Board footer

Powered by FluxBB