Thanks you so much it works.
• 0 views
•
link
Hello I have a fasta file as
>jgi|FusspF23_1|104542
GGTTCTCTTGTCTGTTTTTAAAAGAGTCTCGAGACCCC||
>jgi|FusspF23_1|10121
GGGGCCGCCCTCGATTCATCAGCGAAATTGCTCAGTCGGGCG||
at the end of fasta sequence I have these symbols "||" which I want to remove. I tried using sed but in that way I will end up removing that symbol "|" in fasta sequence description line ">jgi|FusspF23_1|104542" which I don't want.
Please help.
Thank you, Ambika
sed 's/[\|]*$//' in.fasta
Thanks you so much it works.
If an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one if they work.

We could also have sed match the first character of a line and replace only when the line does not start with a >:
sed '/^[^>]/s/|//g' in.fasta
awk '{gsub("\\|\\|","");print}' in.fasta
cat file.fasta | tr -d '||' > fixed.fasta
perl -pe 's/\|+$//' in.fasta
Log in to answer this question.