1 2 3 4 5 6 7 | #!/bin/bash
tmp=$(mktemp)
# or from dpkg --get-selections
packages=$(dpkg -l | awk '/^ii/ {gsub(":.*",""); print $2}' | xargs)
apt-cache policy ${packages} | awk '/^[a-zA-Z1-9-]*:/ {gsub(":",""); pkg=$1} /archive/ {printf("%s\t%s\n", $3, pkg)}' | sort | uniq > ${tmp}
cat ${tmp}
cut -f 1 ${tmp} | uniq -c
|