On Sun, 16 Mar 2003, Andrew Savige wrote:
> En op 16 maart 2002 sprak Rick Klement:
> > And one without that ugly \S :
> >
> > s/^((.+ ).+)\n\2/$1 /m&&redo
>
> That looks fine to me. I noticed Bass sprak on 13 maart:
>
> > #!perl -p0
> > s#^(\S* )(.*)\n\1#$1$2 #m&&redo
> >
> > If the input cont
En op 16 maart 2002 sprak Rick Klement:
> And one without that ugly \S :
>
> s/^((.+ ).+)\n\2/$1 /m&&redo
That looks fine to me. I noticed Bass sprak on 13 maart:
> #!perl -p0
> s#^(\S* )(.*)\n\1#$1$2 #m&&redo
>
> If the input contains no duplicate lines, the "\S*" can be replaced >
with ".*".
Andrew Savige wrote:
>
And one without that ugly \S :
s/^((.+ ).+)\n\2/$1 /m&&redo
at 31 with a hard \n.
--
Rick Klement
En op 13 maart 2003 sprak Bass:
> here's another (equal length, stupid \Q :-)
> this works since perl kindly resets the //g search upon modify.
>
> #!perl -p0
> s/\G\n\Q$1/ /while/(\S+ ).*/g
I enjoyed this clever solution. It works for Perl 5.6.1 and 5.8.0
but not for Perl 5.005_03.
> and if we e
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
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 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 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, 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