Use dpkg-query -l instead of dpkg -W.