Skip to content

Instantly share code, notes, and snippets.

@telendt
Created October 1, 2010 23:08
Show Gist options
  • Save telendt/607038 to your computer and use it in GitHub Desktop.
Save telendt/607038 to your computer and use it in GitHub Desktop.
print currency exchange rate table in a shell (Polish only)
#!/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