zshrc: use dpkg-query instead of grep-status for debs-by-size alias
authorMichael Prokop <mika@grml.org>
Sat, 10 Sep 2011 11:11:07 +0000 (13:11 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 7 Nov 2011 12:15:50 +0000 (13:15 +0100)
Packages without Installed-Size cause a conflict for the
paste/sort command when using the grep-status command line.
So lets use dpkg-query with an according sed/sort command
line instead.

Thanks: Thorsten Glaser <tg@mirbsd.org>

etc/zsh/zshrc

index b33fc97..88950ca 100644 (file)
@@ -1648,9 +1648,9 @@ if [[ -r /etc/debian_version ]] ; then
 fi
 
 # sort installed Debian-packages by size
-if check_com -c grep-status ; then
+if check_com -c dpkg-query ; then
     #a3# List installed Debian-packages sorted by size
-    alias debs-by-size='grep-status -FStatus -sInstalled-Size,Package -n "install ok installed" | paste -sd "  \n" | sort -rn'
+    alias debs-by-size="dpkg-query -Wf 'x \${Installed-Size} \${Package} \${Status}\n' | sed -ne '/^x  /d' -e '/^x \(.*\) install ok installed$/s//\1/p' | sort -nr"
 fi
 
 # if cdrecord is a symlink (to wodim) or isn't present at all warn: