User:Silviolorusso/Mixsvg

From XPUB & Lens-Based wiki
< User:Silviolorusso
Revision as of 17:53, 16 October 2011 by Silviolorusso (talk | contribs) (Created page with "A little script to mix two .svg files in one. Still not completely working. <source lang="bash"> #!/bin/sh # a simple script to mix two .svg in one. # Usage: command <file1> <...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A little script to mix two .svg files in one. Still not completely working.

 
#!/bin/sh

# a simple script to mix two .svg in one.
# Usage: command <file1> <file2>

cat $1 > temp.svg

# remove conflicting tags
awk 'match($0,"<svg") == 0 {print $0}' $2 > info 
awk 'match($0,"<?xml") == 0 {print $0}' info > info2
awk 'match($0,"<!DOCTYPE") == 0 {print $0}' info2 > info3


awk 'match($0,"</svg>") == 0 {print $0}' temp.svg > mix.svg

# appending second svg after first one
cat info3 >> mix.svg


# remove temporary files
rm info
rm info2
rm info3
rm temp.svg

Examples with Clip arts taken from http://www.openclipart.org/

File:Mix1.jpg File:Mix2.jpg File:Mix3.jpg