Home > Net >  how to add a character before every line?
how to add a character before every line?

Time:07-09

I have a big txt file where I want to add a fasta symbol before every line as a new line. I tried with sed, I can add it before the line but not as a new line.

I have file like this

AAAAAAAAAACA
AAAAAAAAAACTTAT
AAAAAAAAACATGTGACTA
AAAAAAAAACTTATTCTTTTT
AAAAAAAACATGTGACT

And I want something like this

>
AAAAAAAAAACA
>
AAAAAAAAAACTTAT
>
AAAAAAAAACATGTGACTA
>
AAAAAAAAACTTATTCTTTTT
>
AAAAAAAACATGTGACT

Thanks,

CodePudding user response:

you can use the sed command like this:

sed 's/^./>\n/g' file.txt> file2.txt
  • Related