What I want do is to purge (via aptitude purge) every package installed with a given string in its name.
E.g. apache2. I've got several packages with the string apache2 in their name installed on a system. Now I want to aptitude purge apache2 (like apache2, apache2.2-bin, libapache2-mod-ruby, etc.). But I do not find a way to do this.
Thanks for your answers in advance.
I would parse the output of dpkg --get-selections, doing something along the following.
(For better understanding, feel free to try the pipe out one step at a time.)
A quick troll through the Aptitude Reference Manual on patterns I found this entry.
Working from that,
aptitude purge ?name('apache2')
will do what you want, but if you're wise you'll run it with-s
the first time so you can see what all it'll remove before committing to the task.