Pipeline in bash to obtain ratio between Euro and USD:
to run in Ubuntu:
chmod a+x ex392.txt ./ex392.txt
ex392.txt
echo "min Euro/USD:" curl -s https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip | gunzip \ | sqlite3 -csv ':memory:' '.import /dev/stdin stdin' "select Date, USD from stdin order by USD asc limit 10;" echo " " echo "max USD/Euro:" curl -s https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip | gunzip \ | sqlite3 -csv ':memory:' '.import /dev/stdin stdin' "select Date, USD from stdin order by USD desc limit 10;"
Output:
min Euro/USD: 2000-10-26,0.8252 2000-10-25,0.8307 2000-10-27,0.8324 2000-10-23,0.8377 2001-07-06,0.8384 2000-10-24,0.8386 2000-11-27,0.8406 2000-10-19,0.8411 2000-10-31,0.8417 2001-07-05,0.8422 max Euro/USD: 2008-07-15,1.599 2008-04-23,1.594 2008-04-22,1.5931 2008-04-16,1.5928 2008-07-22,1.5919 2008-04-21,1.5898 2008-07-16,1.5888 2008-07-03,1.5885 2008-04-10,1.5875 2008-04-17,1.5872
1) сurl downloads official historical data published by the European Central Bank on the position of the euro relative to other currencies. (The -s flag is to not show a progress bar or error messages.)
2) This data comes in the form of a zip file, which gunzip will extract.
3) sqlite3 reads CSV. The :memory option of sqlite says to use the file in memory. After this, .import /dev/stdin stdin tells sqlite to load standard input into a table named stdin. The line following it is an SQL query.
Recent Comments