Last active
November 16, 2019 03:15
-
-
Save dardo82/c925b1982729666c025fbd6215fe08d5 to your computer and use it in GitHub Desktop.
Sort PIP pkgs by size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for port in $(port info --line --name installed); do | |
port contents $port | grep / | xargs du -cks \ | |
| grep "\ttotal" | sed s/total/$port/; done | sort -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
setopt extended_glob | |
cd $(pip$1 show pip | awk '/Loc/{print $2}') | |
PYPKGV=($(pip$1 list | awk '/[0-9]/{print $1}')) | |
PYPKGV=(${(u)^${PYPKGV[*]}%%-*}) | |
MAXLEN=${#${${(@O)${PYPKGV//?/.}}[1]}} | |
for SHPAT in $PYPKGV; do | |
echo -n "$SHPAT\t"; du -cks (#i)$SHPAT* | awk '/total/{print $1"k"}' | |
done | expand -t$[$MAXLEN+1] | sort -k2 -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment