I have a folder with 28 gz files with the extension .gz and 28 files with the extension .gz.bam.
I would like to unzip all the 28 .gz files and send them to another folder. I was doing one by one as follows:
gunzip -c file1.gz > /mnt/s3/data_transfer/file1
How can I specify I want the .gz and not the .gz.bam?
First, let's find the files:
We find the files whose name ends with gz and save them into foo.sh. Let's open it:
Now, we prepend the
gunzipcommand to each line. Let's hit the:key, so at the bottom of the file you can enter a command. Now, let's enter this command:this replaces the start of each line with the text we want to prepend.
Then we append the destination path, by pressing
:again and pasting the following:of course, instead of
\/some\/pathyou will need to use your own path.Finally, add
to remove all the gz extensions from the files in /some/path (replace this with your actual path)
Note that you may need to install
renameand here I assumed that the target path already existed.