On Thu, Mar 02, 2023 at 09:45:38AM +0000, Jonathan Dowland wrote: > --✂--✂--✂--✂--✂--✂--✂--✂--✂--✂ --✂--✂--✂--✂--✂--✂--✂--✂--✂--✂-- > > STATUS_FILE=/var/lib/dpkg/status > dpigs() > { > TL=${1-10} > awk -v RS='' '/Status:.*installed\n/' "$STATUS_FILE" \ > | grep -E '^(Installed-Size|Package)' \ > | cut -d: -f2- \ > | paste - - \ > | sort -rnk2 \ > | awk '{ print $2 "\t" $1 }' \ > | head -n "$TL" \ > | tac > } > dpigs "$@" > > --✂--✂--✂--✂--✂--✂--✂--✂--✂--✂ --✂--✂--✂--✂--✂--✂--✂--✂--✂--✂--
I don't understand why you used sort -r, but then reversed it again with tac at the end. You could drop both of the reversals, and just change head to tail. Anyway... I wrote mine in perl, quite a few years ago (timestamp says September 2004). There's a copy at <https://wooledge.org/~greg/ds>. I named it before I even knew that "dpigs" existed. I can't blame past me for not knowing... dpigs is extremely well hidden.