Deleting an illegal character (') in taxon names from many nexus alignments using tr -d
1
0
Entering edit mode
5.0 years ago
Badh2 • 0

Hello,

I want to remove the chacater ' (apostrophe) from a taxon name in all my nexus alignments (~600). I got it worked for a single file but I need help to put this into a loop. Any help on this is appreciated. Following worked for a single file. tr -d "'" < test.nex > testX.nex

Following are what I tried for loops, but nothing worked!

for filename in *.nex; do
   tr -d "'" $filename;`
done

for filename in $(cat *.nex) do;
   'tr -d "'"' $filename > $filename.new
done

tr -d "'" < *.nex

Thanks!

tr -d deleting character • 763 views
ADD COMMENT
1
Entering edit mode
5.0 years ago
GenoMax 147k

Have you tried for filename in *.nex; do cat ${filename} | tr -d "'" ${filename} > ${filename}.new; done?

ADD COMMENT
0
Entering edit mode

It worked with a little modification Genomax. Thanks! I used following with a just an extra <

for filename in *.nex; do
   cat ${filename} | tr -d "'" < ${filename} > N_${filename};
done
ADD REPLY

Login before adding your answer.

Traffic: 2328 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