#!/bin/sh

TMPFILE=tmpfile
mkdir -p new

for filename in *.xml; do
    if [ "$filename" = "tgv.xml" ]; then
        header=5
    else
        header=6
    fi
    sed "$header"q org/$filename > $TMPFILE
    if [ "$filename" = "lc.xml" ]; then
        sed -n '6,$p' $filename | sed -e 's/div1/div/g' | perl ./dropcvslog.pl >> $TMPFILE
    elif  [ "$filename" = "ven.xml" ]; then
        # changed div1/div only for xsl
        cp org/$filename $TMPFILE
    else 
        sed -n '6,$p' $filename | perl ./dropcvslog.pl >> $TMPFILE
    fi    
    mv $TMPFILE new/$filename
done
