Re: [SLUG] scripting context problem

From: Eben King (eben1@tampabay.rr.com)
Date: Sun Mar 12 2006 - 22:44:11 EST


On Sun, 12 Mar 2006, Jason Boxman wrote:

> On Sunday 12 March 2006 18:32, Eben King wrote:
>> I wrote this small script to calculate the amount of disk space a package
>> takes up:
>
> Or try:
>
> `apt-get install feta`
> `feta package-sizes -s`
>
> ...
> mozilla-thunderbird 32971 kB
> tetex-extra 39176 kB
> tetex-base 53268 kB
> openoffice.org-common 56104 kB
> sun-j2re1.5 87216 kB
> openoffice.org-core 110704 kB

Too late:

#!/bin/bash

for pkg in `dpkg -l '*' | grep '^i' | colrm 1 4 | cut -f 1 -d ' '` ; do
     sum=`{
         echo 0
         dpkg -L "$pkg" \
         | sed -e '/^$/d' -e 's/^\(.*\)$/"\1"/' \
         | tr '\n' ' ' \
         | xargs ls -lgd 2> /dev/null \
         | grep ^- \
         | tr -s ' ' \
         | cut -f 4 -d ' ' \
         | sed 's/$/ +/'
         echo 1024 / p
     } | dc`
     echo "$sum $pkg"
done

Probably quite a bit smaller than feta. Probably not faster (or even
close), though.

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar

Q: What kind of modem did Jimi Hendrix use? A: A purple Hayes. ----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:55:17 EDT