[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] How one can do untar a file and gzip its files with one comman
From: |
Ehsan Hajiramezanali |
Subject: |
[Bug-tar] How one can do untar a file and gzip its files with one command line? |
Date: |
Tue, 5 Apr 2016 11:12:04 -0500 |
Hi
I want to untar a file and directly gzip its contents in one command line.
I have the following example to create the files:
~~~
tmpdir=$(mktemp -d)
tarfile=file.tar.gz
file1=file1.fastq
file2=file2.fastq
cd "$tmpdir"
cat > "$file1" <<EOF
>A
ABCD
EOF
cat > "$file2" <<EOF
>B
ABCDEF
EOF
tar cvf "$tarfile" "$file1" "$file2"
~~~
I want to untar the original file (i.e. file.tzr.gz) and directly gzip
the untar files (i.e. file1.fastq and file2.fastq) with one command
and have the following files:
file1.fastq.gz
file2.fastq.gz
The way that I apply now is the following commands:
~~~
tar xvfz "$tarfile"
gzip *.fastq
~~~
However, I do not want the intermediate files between untar and gzip.
Is there any way to do both the command lines in one command line?
Thanks in advance.
Best regards,
Ehsan
- [Bug-tar] How one can do untar a file and gzip its files with one command line?,
Ehsan Hajiramezanali <=