Como posso desinstalar apenas uma das versões do Libre Office?

0

Eu tenho as duas versões do Libre Office instaladas - 4.3 e o padrão:

dpkg --get-selections | grep -v deinstall | grep libreoffice

mostra

libreoffice-avmedia-backend-gstreamer
libreoffice-base-core
libreoffice-calc
libreoffice-common
libreoffice-core
libreoffice-draw
libreoffice-help-en-gb
libreoffice-help-en-us
libreoffice-impress
libreoffice-l10n-en-gb
libreoffice-l10n-en-za
libreoffice-math
libreoffice-pdfimport
libreoffice-style-galaxy
libreoffice-writer
libreoffice4.3
libreoffice4.3-base
libreoffice4.3-calc
libreoffice4.3-debian-menus
libreoffice4.3-dict-en
libreoffice4.3-dict-es
libreoffice4.3-dict-fr
libreoffice4.3-draw
libreoffice4.3-en-us
libreoffice4.3-impress
libreoffice4.3-math
libreoffice4.3-ure
libreoffice4.3-writer

Eu só quero libreoffice4.3-* e não libreoffice^/(?!4.3)-*

Existe uma maneira de usar esse tipo de regex no comando apt-get ?

por Tim 23.09.2014 / 22:10

1 resposta

1

apt-get aceita regexes POSIX (não caracteres curinga):

sudo apt-get remove '^libreoffice4.3-*'

removerá

libreoffice4.3
libreoffice4.3-base
libreoffice4.3-calc
libreoffice4.3-debian-menus
libreoffice4.3-dict-en
libreoffice4.3-dict-es
libreoffice4.3-dict-fr
libreoffice4.3-draw
libreoffice4.3-en-us
libreoffice4.3-impress
libreoffice4.3-math
libreoffice4.3-ure
libreoffice4.3-writer

e aqueles que dependem deles. (É por isso que apt-get remove libreoffice4* não faz o que você acha que faria.)

Então tente:

sudo apt-get remove '^libreoffice-.*' libreoffice

que removerá:

libreoffice-avmedia-backend-gstreamer
libreoffice-base-core
libreoffice-calc
libreoffice-common
libreoffice-core
libreoffice-draw
libreoffice-help-en-gb
libreoffice-help-en-us
libreoffice-impress
libreoffice-l10n-en-gb
libreoffice-l10n-en-za
libreoffice-math
libreoffice-pdfimport
libreoffice-style-galaxy
libreoffice-writer
libreoffice

Em man apt-get :

If no package matches the given expression and the expression
contains one of '.', '?' or '*' then it is assumed to be a POSIX
regular expression, and it is applied to all package names in the
database. Any matches are then installed (or removed). Note that
matching is done by substring so 'lo.*' matches 'how-lo' and
'lowest'. If this is undesired, anchor the regular expression with
a '^' or '$' character, or create a more specific regular
expression.
    
por muru 23.09.2014 / 22:20