Entering edit mode
2.1 years ago
nitinra
▴
50
Hello all,
I have about ~150 sub directories in a directory. Each of those subdirectories contains multiple fasta files. I want to rename all the fasta headers with adding the name of the file.
I tried using this command:
for i in ./*mg/*.faa; do gawk -i inplace '/>/{gsub(">","&"FILENAME"_");gsub(/\.faa/,x)}1' $i; done
This command however renames the fasta headers with sub-folder name (*mg) and the filename. How do I modify this command to just include the filename??
If you get "Argument list too long" use:
find ./*mg -name "*.faa" | parallel 'seqkit replace -p "(.+)" -r "\$1 {/}" {} > {= s/\.faa/.renamed.faa/ =}'