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

Oleg Permalink
September 22, 2011, 16:42

this can be solved with sed and without recursion:

$ perl -e 'print "0"x10 . "1"x10 . "\n"' > x
$ cat x
00000000001111111111
$ cat x.sed
# match 0n1n
/^00*11*$/{
h
:again
/^00*11*$/{
s/01//
t again
}
/^$/{
x
p
}
}

$ sed -n -f x.sed x
00000000001111111111

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

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

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