View Single Post
Old 01-13-2015, 08:01 AM   #2
ajk
Junior Member
 
Location: Massachusetts

Join Date: Feb 2009
Posts: 1
Default

You're almost all the way there: just move the $1 to the end of the replacement string. Also, it'll be a little easier if you take the greater than (>) out of the match.

Code:
perl -p -e 's/^>(.*)/>New_Header_Info $1/' input.fasta > output.fasta
For this, you really don't need the /g at the end since you're matching the whole line and, because the .* is greedy, the $ at the end of the match string is unnecessary as well.
ajk is offline   Reply With Quote