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

Anirudh Permalink
February 01, 2016, 16:37

We have to keep track of transitions from
i) non-JU -> JU
ii) non-JU -> non-JU
iii) JU -> JU
iv) JU -> non-JU
and also keep an eye on the 1st and last line actions to be taken.

Once that is clear, then the sed code writes itself...

sed -e '
   /^JU/{
      x
         /^JU/!{
            s/^/#/
         }
         bprint
      #x
   }

   #/^JU/!{
      x
         #/^JU/{
            bprint
         #}
      #x
   #}

   :print
   1!p; $!d; g
'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

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

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