Last active
November 27, 2016 16:11
-
-
Save Pephers/5773393 to your computer and use it in GitHub Desktop.
Update and delete nodes in many XML files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delete node | |
find . -name modules.xml | xargs xmlstarlet ed -L -d '//node' | |
# update attribute | |
find . -name modules.xml | xargs xmlstarlet ed -L -u '//node/@attr' -v 'value' | |
# indent with 4 spaces | |
for i in $(find . -name 'modules.xml'); do xmlstarlet fo -s 4 "$i" > "$i.tmp"; mv "$i.tmp" "$i"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment