2 ms·
The example is failing at decompression for me, and I suspect it's because of this: > That data comes as a zipfile, which gunzip will decompress. Doesn't gunz
by lxgr 3y ago
The example is failing at decompression for me, and I suspect it's because of this:
> That data comes as a zipfile, which gunzip will decompress.
Doesn't gunzip expect gzip files, as opposed to ZIP (i.e. .zip) files?
On Linux I get further (apparently Linux gunzip is more tolerant of the format error than the macOS default one), but there, I then run into:
> Error: no such column: Date
- gniv 3y agoThe example works on my MacBook if I replace gunzip with funzip. Also, I like to see the value. So: curl -s https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip | funzip | sqlite3 -csv ':memory:' '.import /dev/stdin stdin' "select Date,USD from stdin order by USD asc limit 1;"
- xomodo 3y agoThx. I have extended a bit as a script: # !/bin/bash ARG1=${1:-'select Date from stdin order by USD asc limit 1;'} curl -o - -Ls https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip \ | funzip | sqlite3 -csv ':memory:' '.import /dev/stdin stdin' "${ARG1}" # Usage: $ ./run.sh 'select * from stdin limit 1;'
- halJordan 3y agoHere's the gzipped tarball of the docs you can read to find out https://www.gnu.org/software/gzip/manual/gzip.txt.gz https://www.gnu.org/software/gzip/manual/gzip.txt.gz
- jandrese 3y agoThis is slightly abusive of gunzip, but it does work, but only because the zipfile in question only contains a single file and you are piping it in via shell. If you had tried to download the file and then run gunzip on it the program would have refused. As for the second error, I think you might be trying to import an empty file or maybe an error message? Probably related to the first problem.
- pixl97 3y agoAt least in Ubuntu it doesn't do anything at all. # gunzip -d master.zip gunzip: master.zip: unknown suffix -- ignored
- lxgr 3y agoIt's a ZIP file, so you'll want to use unzip, not gunzip. Ubuntu's version of g(un)zip actually does tolerate ZIP inputs though; for that usage, just omit the '-d'.
- hddqsb 3y agoPer the docs (I linked them in another comment), the correct command is `gunzip <foo.zip` or `gunzip -S .zip foo.zip`.
- deleted 3y ago[deleted]
- hddqsb 3y agoGNU gzip has limited support for ZIP: > Files created by zip can be uncompressed by gzip only if they have a single member compressed with the “deflation” method. This feature is only intended to help conversion of tar.zip files to the tar.gz format. -- https://www.gnu.org/software/gzip/manual/html_node/Overview.html https://www.gnu.org/software/gzip/manual/html_node/Overview....