Как я могу удалить только одну из версий Office Libre?

У меня есть обе версии установленного Office Libre - 4.3 и значение по умолчанию:

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

шоу

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

Я только хочу libreoffice4.3-* и нет libreoffice^/(?!4.3)-*

Есть ли способ использовать этот вид regex в apt-get команда?


0
задан 24 September 2014 в 00:10

1 ответ

apt-get принимает POSIX regexes (не подстановочные знаки стиля оболочки):

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

удалит

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

и те, которые зависят от них. (Вот почему apt-get remove libreoffice4* не делает то, что Вы думаете, что это было бы.)

Так попытка:

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

, который удалит:

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

От 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.
1
ответ дан 7 October 2019 в 01:39

Другие вопросы по тегам:

Похожие вопросы: