golf anyone?

Mike Markley mike@markley.org
Wed, 26 Feb 2003 12:59:00 -0800


On Tue, Feb 25, 2003 at 11:14:53PM -0800, ivan-bad@420.am <ivan-bad@420.am> wrote:
> perl -ne '/^([\w\-]+): (.*)$/ and ${$1}=$2;next if (/^ \.$/ and $l=1
> );print "$Package $Version\n" if $l && /^$/;$l=0;' /var/lib/dpkg/available
> 
> or, shorter but not as future-proof:
> 
> perl -ne '/^(\w\w)[\w\-]+: (.*)$/ and ${$1}=$2;next if (/^ \.$/ and $l=1
> );print "$Pa $Ve\n" if $l && /^$/;$l=0;' /var/lib/dpkg/available

I'm not entirely convinced that putting a trailing empty line (" .") at
the end of a description is invalid... but perhaps you had another point
;)

-- 
Mike Markley <mike@markley.org>
GPG: 0x3B047084 7FC7 0DC0 EF31 DF83 7313  FE2B 77A8 F36A 3B04 7084

C makes it easy to shoot yourself in the foot; C++ makes it harder,
but when you do it blows your whole leg off.
-Bjarne Stroustrup