문제

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?

도움이 되었습니까?

해결책

You can say:

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

You can read more about Process Substitution here.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top