Created
September 12, 2013 14:07
-
-
Save mughilanand/6537996 to your computer and use it in GitHub Desktop.
Function to parse XML file in Shell Script
This file contains hidden or 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
##### Helper function to parse xml #################################################################################### | |
function rdom () { local IFS=\> ; read -d \< E C ;} | |
## pass tag name as parameter | |
function parseFirstElement () { | |
while rdom; do | |
if [[ $E = $1 ]]; then | |
echo $C | |
return 0 | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment