You're replying to a comment by Robby.

Robby Permalink
September 27, 2010, 23:05

Great article!

@Eszter
Nice challenge. There could be a shorter way to do this, but I used the branch technique with labels described above and came up with:

sed -e :a -e 's/^\(-*\)-/\1N/;ta' -e :b -e 's/-\(-*\)$/N\1/;tb'

The first two expressions set a label then loop substituting the dashes inside out. Then I basically mirrored the process for the backside.

$ cat taxon
----tgattagcat---
tgattag---tga-tag-
---tafasf--fasdf--

$ cat taxon | sed -e :a -e 's/^\(-*\)-/\1N/;ta' -e :b -e 's/-\(-*\)$/N\1/;tb'
NNNNtgattagcatNNN
tgattag---tga-tagN
NNNtafasf--fasdfNN

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "computer_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.