#!/bin/bash
echo Last update: `grep -o 'DateTime="[^"]*"' $1 | sed -e 's/DateTime="\([^"]*\)"/\1/'`
grep -o 'Percent="[^"]*" Price="[^"]*"' $1 |
sed -e 's/Percent="\([^"]*\)" Price="\([^"]*\)"/: \2 (% \1)/'
This will display
Last update: 17/09/2010 18:00:00
: 63.862 (% 0.20)
: 80.989 (% 0.25)
: 1.4970 (% 0.07)
: 1.9530 (% -0.31)
Didn't know what IMKB, USD and EUR means, if they are based on Percent then you can use this
#!/bin/bash
echo Last update: `grep -o 'DateTime="[^"]*"' $1 | sed -e 's/DateTime="\([^"]*\)"/\1/'`
grep -o 'Percent="[^"]*" Price="[^"]*"' $1 |
sed -e 's/Percent="\([^"]*\)" Price="\([^"]*\)"/: \2 (% \1)/' |
sed -e 's/\(.*(% 0.20)\)/IMKB: \1/' |
sed -e 's/\(.*(% 0.07)\)/USD: \1/' |
sed -e 's/\(.*(% -0.31)\)/EUR: \1/'
Above will display
Last update: 17/09/2010 18:00:00
IMKB: : 63.862 (% 0.20)
: 80.989 (% 0.25)
USD: : 1.4970 (% 0.07)
EUR: : 1.9530 (% -0.31)
I didn't know sed very well so mayby there is simple and shorter solusion using only sed.
Update
This is shorter version
#!/bin/bash
echo Last update: `grep -o 'DateTime="[^"]*"' $1 | sed -e 's/DateTime="\([^"]*\)"/\1/'`
grep -o 'Percent="[^"]*" Price="[^"]*"' $1 | sed -e 's/Percent="\([^"]*\)" Price="\([^"]*\)"/: \2 (% \1)/' -e 's/\(.*(% 0.20)\)/IMKB\1/' -e 's/\(.*(% 0.07)\)/USD\1/' -e 's/\(.*(% -0.31)\)/EUR\1/' -e 's/\(.*(% 0.25)\)/SD\1/'
Last update: 17/09/2010 18:00:00
IMKB: 63.862 (% 0.20)
SD: 80.989 (% 0.25)
USD: 1.4970 (% 0.07)
EUR: 1.9530 (% -0.31)