On Sun 06 Nov 2016 at 08:18:52 (+0100), Steve wrote: > Hi Sven and Axel, > > Thank you for your explanation, I understand a bit better the logic. But > there is still something that doesn't quite match. Please consider the > following. > > apt-cache policy | grep 'a=' > release a=now > release > v=14.04,o=LP-PPA-opencpn-opencpn,a=trusty,n=trusty,l=OpenCPN,c=main > release o=Debian Mozilla > Team,a=jessie-backports,n=jessie-backports,l=Debian Mozilla > Team,c=firefox-release > release v=8.6,o=Unofficial Multimedia > Packages,a=stable,n=jessie,l=Unofficial Multimedia Packages,c=non-free > release v=8.6,o=Unofficial Multimedia > Packages,a=stable,n=jessie,l=Unofficial Multimedia Packages,c=main > release o=Debian Backports,a=jessie-backports,n=jessie-backports,l=Debian > Backports,c=contrib > release o=Debian Backports,a=jessie-backports,n=jessie-backports,l=Debian > Backports,c=main > release v=8,o=Debian,a=stable,n=jessie,l=Debian-Security,c=non-free > release v=8,o=Debian,a=stable,n=jessie,l=Debian-Security,c=contrib > release v=8,o=Debian,a=stable,n=jessie,l=Debian-Security,c=main > release v=8.6,o=Debian,a=stable,n=jessie,l=Debian,c=contrib > release v=8.6,o=Debian,a=stable,n=jessie,l=Debian,c=non-free > release v=8.6,o=Debian,a=stable,n=jessie,l=Debian,c=main > > > Now let's plug the value of a in 'aptitude search ~A$a~i | wc -l': > > > a= aptitude search ~A[$a]~i | wc -l > dpkg -l | grep ^ii | wc -l > trusty 16 > jessie$ 0 > jessie-backports 248 > stable 3243 > TOTAL 3507 3349 > now 3349 3349 > > > so 3507 ≠ 3349. Both figures should be equal as I understand. It seems > that some packages are counted two or more times or my calculation is > plain wrong. > > Thoughts?
Piping to wc -l throws most of the information away. Redirect the output to files instead, thus: search jessie > /tmp/jessie ... repeated for others ... search total | sort > /tmp/total Now: cat /tmp/jessie /tmp/all-the-others | sort | diff -u - /tmp/total | less -S and see exactly what's going on. The lines starting with "-" are the ones which are in the concatenation of files but not in the total file. Vice versa for "+". Cheers, David.