Pergunta

I have two compressed files. ( file1.gz and file2.gz ). I would like to unzip them and send the output to another command as separate inputs. something like:

gunzip -c file1.gz file2.gz | command -1 file1 -2 file2

How could I achieve this?

Foi útil?

Solução

You can say:

command -1 <(gzip -dc file1.gz) -2 <(gzip -dc file2.gz)

You can read more about Process Substitution here.

Outras dicas

Kindly check with below command, it will give you output for list of files exacted.

 # ls
 checknum.txt  numbers.txt

 # gzip  checknum.txt numbers.txt

 # ls
 checknum.txt.gz  numbers.txt.gz

 # gunzip -vd *.gz 1>& check ; cat check | awk '{print $6}'
 checknum.txt
 numbers.txt

Thanks.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top