I have a directory which consists of multiple sub-directories. Each subdirectory has a tar.gz file which on untar gives two files namely R1.fastq and R2.fastq. I want to untar the tar file and compress R1.fastq and R2.fastq immediately after piping,and save the output of each sub-directories into another SINGLE directory.
sourcedir=/sdir destdir=/ddir for f in $sourcedir/*; do fbase=${f##*/} echo "Inside $fbase" tar -xvf $f/*.gz |gzip -n9 $f/*.fastq > $destdir/ done I wrote the above code but it goes until the echo command.