Created
October 1, 2010 23:08
-
-
Save telendt/607038 to your computer and use it in GitHub Desktop.
print currency exchange rate table in a shell (Polish only)
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
#!/usr/bin/env bash | |
(echo 'NAZWA WALUTY|PRZELICZNIK|KOD WALUTY|KURS ŚREDNI'; curl -s --compressed "http://www.nbp.pl/kursy/xml/`curl -s --compressed 'http://www.nbp.pl/kursy/xml/dir.txt' | tr -d '\r' | grep '^a' | sort -k1.6n | tail -1`.xml" | sed -e '/<\?xml.*?\?>/d' | iconv -f CP1250 | xml2 | grep -E 'nazwa_waluty|przelicznik|kod_waluty|kurs_sredni' | cut -d= -f 2- | sed -e 'N;N;N;s/\n/|/g' | sort -t '|' -k 3) | column -tx -s "|" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment