Q:

Split XML file based on string

i've mixed up some xml files and now have something like
<Schema>
stuff
</Schema><Schema>
stuff
</Schema><Schema>
..

i need to split them all so to have from <Schema> to </Schema> in each file

A:

One way using awk. It splits registers with end tag and if there are characters before it print all it:
awk -c '
    BEGIN { RS = "</Schema>" } 
    $0 ~ /[^[:blank:]\n]/ { 
        printf "%s\n", $0 RS >> FILENAME "_" ++i ".xml" 
    }
' infile

Assuming infile with content:
<Schema>
stuff
</Schema><Schema>
more stuff
</Schema><Schema>
and more stuff
</Schema>

It yields:
==> infile_1.xml <==
<Schema>
stuff
</Schema>

==> infile_2.xml <==
<Schema>
more stuff
</Schema>

==> infile_3.xml <==
<Schema>
and more stuff
</Schema>

