my code:
${execi 3600 wget -q -O - "http://www.google.com/finance/converter?a=1&from=USD&to=PLN"|grep "<div id=currency_converter_result>"|sed 's/<[^>]*>//g'}
i trying to get currency rate from google finances:
https://www.google.com/finance/converter?a=1&from=USD&to=PLN
result its:
1 PLN = 3.0321 USD
how i can mod my code to get result:
USD 3.03
Thanks!
You can get it like this:
wget -q -O - "http://www.google.com/finance/converter?a=1&from=USD&to=PLN"|awk -F"[ >]" '/<div id=currency_converter_result>/ {printf "%s %.2f\n",$4,$8}'
USD 3.03
To get it into an variable:
val=$(wget -q -O - "http://www.google.com/finance/converter?a=1&from=USD&to=PLN"|awk -F"[ >]" '/<div id=currency_converter_result>/ {printf "%s %.2f\n",$4,$8}')
echo "$val"
USD 3.03