perl -MXML::Twig -e "map{$t=XML::Twig->new(twig_handlers=>{$s?('catalog'=>sub{foreach$c(@c){$c->paste(last_child=>$_)}}):('newitems/book'=>sub{push@c,$_;$_->cut})})->parsefile($_);$s++;}@ARGV;$t->flush" newbook.xml catalog.xml