Reputation: 33
How to change with awk/sed/grep the header of more fasta sequences in a file like:
>chromosome1|2199-2200
----------------------
>chromosome1|3546-3548
----------------------
>chromosome1|6489-6548
----------------------
to this:
>chromosome1-1|2199-2200
------------------------
>chromosome1-2|3546-3548
------------------------
>chromosome1-3|6489-6548
------------------------
At the moment I just can add a sequential number at the beginning or end of the name like:
awk '/^>/{gsub(/^>/,">Seq"i++" ");}1'
>Seq1chromosome1|2199-2200
Upvotes: 1
Views: 1382
Reputation: 203368
$ awk '/>/{sub(/\|/,"-"++i"|")}1' file
>chromosome1-1|2199-2200
----------------------
>chromosome1-2|3546-3548
----------------------
>chromosome1-3|6489-6548
----------------------
Upvotes: 2