Maybe, this "one-liner" does what you want? aptitude -F "%p" search ~Astable| sort | \ (aptitude -F "%p" search ~Aunstable ~Atesting | sort -u | \ comm -23 --nocheck-order /dev/fd/3 -) 3<&0
All three archives have to be present with the names used above in your sources.list file (that is, e.g., "unstable" and not "sid"). Regards, jvp.