15

I want to download and to gunzip file.

  wget ftp://ftp.direcory/file.gz
  gunzip file.gz

Works fine.

However I want to simplify such command and tried this:

 gunzip <(wget ftp://ftp.direcory/file.gz)

wget downloads file, but gunzip task doesn't start.

Where is my mistake?

pogibas
  • 27,303
  • 19
  • 84
  • 117
  • This will work with HTTP(S) urls but not FTP ones: `wget --compression=auto -O file.html https://.......` – gregn3 Jan 26 '20 at 17:10

1 Answers1

29

Try

  wget -O - ftp://ftp.direcory/file.gz | gunzip -c > gunzip.out

Read more the wget documentation.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • You need the -c parameter in order to have gzip output to the console, btw. Else it just overwrites its input. – hd1 Apr 28 '13 at 12:49
  • The below does 3 things `mkdir -p ${DIR} && curl -L http://apachemirror.wuchna.com/spark/spark-2.4.5/spark-2.4.5-bin-hadoop2.7.tgz | tar zxv -C ${DIR} --strip-components 1` 1. Force creates the destination directory 2. UnArchives the archive to the given directory 3. Replaces the root directory with the given directory name by simply stripping down the archive's root directory. – Sathish Mar 22 '20 at 19:31