Hi Mensur Dlakic,
Thanks so much! It worked. I also found another way: sed -i -se 's/?/N/g' *.fasta.
How can I replace a character in multiple fasta files within a folder?
More specific, I want to replace the character "?" by "N" through multiple fasta files.
Thanks in advance for your advice.
Assuming that your files all end in .fasta, go to that directory and type:
find . -name "*.fasta" | xargs -i sed -i 's/\?/N/g' {}
Yet another approach:
for f in *.fasta ; do sed -i 's/\?/N/g' $f ; done
Hi Mensur Dlakic,
Thanks so much! It worked. I also found another way: sed -i -se 's/?/N/g' *.fasta.
look at find /path/to/dir -exec and Remove unwanted characters from FASTA file
Thanks for your prompt response, however I do not want to remove the character "?", I want to replace it by "N". I tried sed -i 's/?/N/g' *, but with no success.
The fact that all of my files end with the letter "A" before the format denomination seems to be an issue for the command.
Do you have an idea how to solve this?
Log in to answer this question.