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, the "\S*" can be replaced with ".*".
Using a literal newline would shave yet another stroke.

  -Bass

Reply via email to