[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Package of non-development scripts?



On Tue, Jul 17, 2001 at 05:01:08PM +0200, Joost Kooij wrote:
> On Tue, Jul 17, 2001 at 05:39:37AM -0400, Matt Zimmerman wrote:
> > 
> > grep-status -nsInstalled-size,Package -F Status ' installed' \
> > | perl -p00l12 -e 's/\n/ /' \
> > | sort -rn
> 
> All perl (faster) one-liner (pythonistas enjoy/shudder):
            ^^^^^^^
> 
> perl -00 -e 'map {printf"%-24s%10d\n",@$_}(sort{$a->[1]<=>$b->[1]}grep{@$_}
>   map{%s=(/^(\S{3})\S+:\s+(.+)$/mg);($s{Sta}=~/ i\S+d$/)?($t+=$s{Ins},
>   [$s{Pac},$s{Ins}]):0;}<>),["total",$t]' /var/lib/dpkg/status

Faster? Don't think so...

$ time -p grep-status -nsInstalled-size,Package etc...
real 0.60
user 0.50
sys 0.02

(that's the worst of 3 runs)

$ time -p perl -00 -e 'map etc...
real 1.33
user 1.10
sys 0.05

(and that's the best of 3 runs)

Regards,

Filip

-- 
Steal this tagline.  I did.

Attachment: pgpAs8qReppOb.pgp
Description: PGP signature


Reply to: