User:Silviolorusso/Mixsvg

From XPUB & Lens-Based wiki

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/

Mix1.svg

Mix2.svg

Mix3.svg