How to convert folder containing .fna.gz to normal files
2
1
Entering edit mode
4.3 years ago
sankadinesh ▴ 20

How to convert .fna.gz files to .fna in a folder?

I would also like to convert all .fna to .fasta.

Thanks in advance

sequencing fasta • 5.4k views
ADD COMMENT
1
Entering edit mode
$ parallel --dry-run 'gzip -d {} > {= s:\.[^.]+$::;s:\.[^.]+$::; =}.fasta' ::: *.fna.gz

You can do it in two simple steps:

 1. rename -n 's/fna/fasta/' *.fna.gz  ## remove n option after checking the before and after output names
 2. gzip *.fasta.gz
ADD REPLY
4
Entering edit mode
4.3 years ago
tothepoint ▴ 940

I hope this will work.

# Rename all *.fna to *.fasta
for f in *.fna; do 
    mv -- "$f" "${f%.fna}.fasta"
done

Or you can try

find . -name '*.fna' -exec rename 's/\.fna$/.fasta/' \{} \;
ADD COMMENT
0
Entering edit mode

HI there, Thanks a lot, It worked. Dinesh

ADD REPLY
1
Entering edit mode
4.3 years ago
tothepoint ▴ 940

Go to the directory and follow the command..:)

find . -name ".fna.gz" |xargs -n 1 gunzip
ADD COMMENT
0
Entering edit mode

HI there, Thanks. I would like to rename all files ending with .fna to .fasta. How to do that ? Regards, Dinesh

ADD REPLY

Login before adding your answer.

Traffic: 1902 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6