Created
August 12, 2016 06:16
-
-
Save altbdoor/a68c8acf4ea817dfb54047881e98f83b to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
filename="$1" | |
parameter="$2" | |
if [[ ! -f "$filename" ]]; then | |
echo "Please specify the file" | |
exit 1 | |
fi | |
if [[ -z "$parameter" ]]; then | |
echo "Please specify the xml attribute" | |
exit 1 | |
fi | |
grep -oE "$parameter=\"[0-9]+\.[0-9]+\"" "$filename" | sed -e "s/^$parameter=\"//" -e "s/\"$//" | awk '{sum+=$1} END{print sum;}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment