On Thu, 13 Mar 2003, Andrew Savige wrote:
> #!perl -p
> s/\S+/$&ne$l&&$m.($l=$&)/e;$m=eof||chop
>
> #!perl -0ap
> $:="\n$F[0]";s/\n\S+/$:=$&if$&ne$:/eg
>
> #!perl -0p
> / /;$:="\n$`";s/\n\S+/$:=$&if$&ne$:/eg
#!perl -p0
s#^(\S* )(.*)\n\1#$1$2 #m&&redo
If the input contains no duplicate lines, t
On Thu, 13 Mar 2003 11:50:23 +0200 (EET)
Tuomo Salo <[EMAIL PROTECTED]> wrote:
> #!perl -p0
> s#^(\S* )(.*)\n\1#$1$2 #m&&redo
>
> If the input contains no duplicate lines, the "\S*" can be replaced with ".*".
> Using a literal newline would shave yet another stroke.
#!perl -p0
s/^((\S+).+)\n\2/
On Thu, 13 Mar 2003 16:14:21 +0100
Marius Ascheberg <[EMAIL PROTECTED]> (I) wrote:
> #!perl -p0
> s/^((\S+).+)\n\2/$1/m&&redo
Sorry, but this is just wrong.
It handles
a a
ab a
wrong.
So we're back to 32 strokes.
#!perl -p0
s/^((\S+).+)\n\2 /$1 /m&&redo
On Thu, 13 Mar 2003 17:20:00 +0100
Marius Ascheberg <[EMAIL PROTECTED]> (I) wrote:
> So we're back to 32 strokes.
>
> #!perl -p0
> s/^((\S+).+)\n\2 /$1 /m&&redo
I was too dumb, again.
So here's my last one, which seems to work and uses 33 strokes:
#!perl -p0
s/^((\S+) .+)\n\2 /$1 /m&&redo
On Thu, 13 Mar 2003, Marius Ascheberg wrote:
> #!perl -p0
> s/^((\S+).+)\n\2/$1/m&&redo
>
> 30 strokes, but I was not able to remove the redo.
very nice, but you broke it :-)
input:
this go
thises kablooey
output:
this goes kablooey
this works:
#!perl -p0
s/^((\S+ ).+)\n\2/$1 /m&&redo
here's