Skip to content

Instantly share code, notes, and snippets.

@mughilanand
Created September 12, 2013 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mughilanand/6537996 to your computer and use it in GitHub Desktop.
Save mughilanand/6537996 to your computer and use it in GitHub Desktop.
Function to parse XML file in Shell Script
##### 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