Skip to content

Instantly share code, notes, and snippets.

@cburgmer
Last active August 29, 2015 14:23
Show Gist options
  • Save cburgmer/adefa258c967613baf9f to your computer and use it in GitHub Desktop.
Save cburgmer/adefa258c967613baf9f to your computer and use it in GitHub Desktop.
How to join JUnit XML files when all you have is basic Unix commands
# For test cases wrapped with <testsuites>. For a single <testsuite> adapt accordingly.
find . -name "*.xml" -exec cat {} \; \
| sed "/<\?xml [^>]*\?>/d" | sed "/<\/*testsuites>/d" \
| (echo '<?xml version="1.0" encoding="UTF-8"?>' && echo '<testsuites>' && cat && echo '</testsuites>') \
> joined_xml
mv joined_xml joined.xml # Avoid the output being mixed up with the input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment