You can combine the two commands as following:
gunzip < file.gz | bzip2 > file.bz2
This will start two processes in parallel, gunzip
reading the file.gz
file and outputting the non-compressed stream to bizp2
to re-compress it into file.bz2
.
This process does not create intermediate files, you'll need to remove the file.gz
afterwards (rm file.gz
).