Entering edit mode
2.5 years ago
mthm
▴
50
this is my fasta file
>BEL-3_Dvir#LINE/BelPao
GTAATTCTTGTGGTAGTTTTATGTTCTATGCAGGTTCAATATCGTACGCGCTCTGTGATG
CCCGCGCAGTACGCGTTTGTTTCCGATAGTTGATAACAAGTAATCGGTACAAATCGATAT
>P-2_Dmel#LINE/P
AATCTCTATATATAAAACTGTTTGTCCTGACTGACTGACTGACTGACTGACTGACTGACT
GACTGATTGGTGATCAACGCACAGCCCAAACCGTAAGAGCTAGGAAGCTGAAATTTTCAC
TGTAGCTACCTTATGTGATGTAGGTGCACGTTAAGACGGGGTTTCGGGAAATTCCACCCG
I want to remove the header after the hash:
>BEL-3_Dvi
GTAATTCTTGTGGTAGTTTTATGTTCTATGCAGGTTCAATATCGTACGCGCTCTGTGATG
CCCGCGCAGTACGCGTTTGTTTCCGATAGTTGATAACAAGTAATCGGTACAAATCGATAT
>P-2_Dme
AATCTCTATATATAAAACTGTTTGTCCTGACTGACTGACTGACTGACTGACTGACTGACT
GACTGATTGGTGATCAACGCACAGCCCAAACCGTAAGAGCTAGGAAGCTGAAATTTTCAC
TGTAGCTACCTTATGTGATGTAGGTGCACGTTAAGACGGGGTTTCGGGAAATTCCACCCG
I tried this code
sed -r -i 's/^>/.*#/\1/' file.fasta
the error is
-e expression #1, char 10: unknown option to `s'
how to fix this?
also, be extremely careful when using the
-i
option ( the in-file modification parameter) , if something goes awol you lost your input file. Always work on a copy of the original file or send the sed output to a new file.