repair /var/lib/dpkg/status


Sometimes I can't use apt-get remove because of some "grep-status: /var/lib/dpkg/status:12345: expected a colon'.

Someone else found a nice solution

For personal reference, the short version:

sudo apt-get install pcregrep
pcregrep -nM '\n\s*\n[^P]+' /var/lib/dpkg/status

This gives a line number. Edit the file, jump to that line number. There is an empty blank line there. Put a dot (.) in there, apt-get update.