How can I speed up splitting large XML files into smaller TXT files?

I am trying to split large XML files into smaller ones. I need to split every 15 lines while skipping the first and last XML tags also while naming the smaller TXT files the name as their parent (plus the split number suffix)

I have tried the xml_split command, but I get a Perl module error regarding

cd ${inDir}

ls ${inDir}/*xml | while read xName


egrep -v <1st and last XML Tag> | split -15 -d -a6

xmlName=$(basename ${xName} | cut -d"." -f1)

find . -type f -name 'x*' | xargs -i basename {} | while read splitName

sxName=$(echo ${splitName} | cut -d"/" -f2)

mv ${splitName} ${xmlName}-${sxName}.txt



I am just looking for a faster/more efficient way to accomplish the splitting/renaming.