Last active
April 20, 2017 11:59
-
-
Save domcleal/cef784d59cf6f4835ae45065918229c8 to your computer and use it in GitHub Desktop.
Copy part of an Augeas XML tree into another file
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
output.xml |
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
#!/bin/bash | |
orig=$PWD/original.xml | |
new=$PWD/output.xml | |
rm -f $new | |
augtool -s -e -t "Xml incl $orig" -t "Xml incl $new" <<EOF | |
cp /files$orig/xml/Child[2]/ChildOfChild/Child /files$new/VirtualHost/Child | |
EOF | |
cat $new |
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
<xml> | |
<Child></Child> | |
<Child> <ChildOfChild> <Child> | |
<Directory foo="bar" /> | |
<Foo>bar</Foo> | |
</Child> </ChildOfChild> </Child> | |
</xml> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment