I may have missed something but arn't there a simpler and more obvious way to do the following: dpkg --no-act --force-bad-path -r some_package 2>&1 | grep "depends on"