in reply to One-liner: -i without .bak?
By the way, you might want to replace perl -pi -e 's/^<div.*>/<div>/' *.xml with perl -pi -e 's/^<div.*?>/<div>/' *.xml As it was, it would match until the last ">" on the line.