You're viewing a comment by Robby and its responses.

Robby Permalink
September 27, 2010, 23:05

Great article!

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

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

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

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

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