Re: A little text file munging golf on the list

2003-03-15 Thread Andrew Savige
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

Re: A little text file munging golf on the list

2003-03-15 Thread Rick Klement
Andrew Savige wrote: > And one without that ugly \S : s/^((.+ ).+)\n\2/$1 /m&&redo at 31 with a hard \n. -- Rick Klement

Re: A little text file munging golf on the list

2003-03-15 Thread Andrew Savige
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 ".*".