9

I am using curl to download a file using the following command.

curl -O https://s3.amazonaws.com/dl4j-distribution/GoogleNews-vectors-negative300.bin.gz

I want to unpack it in a pipeline in the following way. curl -O url | unpack it and store it here in current directory

I used the following command, however, it does not work. I get"gzip: stdin: not in gzip format" Any ideas how can I achieve this?

curl -O https://s3.amazonaws.com/dl4j-distribution/GoogleNews-vectors-negative300.bin.gz | gunzip

I simply want to achieve something like this:

download somecompressedfile | decompress it.

or as simple as this:

ls | grep test.gz | decrompess test.gz
nickg
  • 93

1 Answers1

10
curl -o - https://s3.amazonaws.com/dl4j-distribution/GoogleNews-vectors-negative300.bin.gz | gunzip > ./GoogleNews-vectors-negative300.bin

Explanation:
- represents the standard output. The standard output is what gets redirected by piping with |.
From man curl:

Specifying the output as '-' (a single dash) will force the output to be done to stdout.

simlev
  • 3,912