首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何仅卸载Libre Office的一个版本?

如何仅卸载Libre Office的一个版本?
EN

Ask Ubuntu用户
提问于 2014-09-23 20:10:11
回答 1查看 504关注 0票数 0

我已经安装了Libre Office的两个版本- 4.3和默认的:

代码语言:javascript
复制
dpkg --get-selections | grep -v deinstall | grep libreoffice

显示

代码语言:javascript
复制
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)-*

apt-get命令中有使用这种正则表达式的方法吗?

EN

回答 1

Ask Ubuntu用户

回答已采纳

发布于 2014-09-23 20:20:35

apt-get接受POSIX (不是shell风格的通配符):

代码语言:javascript
复制
sudo apt-get remove '^libreoffice4.3-*'

将移除

代码语言:javascript
复制
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*不像你想的那样做。)

所以试着:

代码语言:javascript
复制
sudo apt-get remove '^libreoffice-.*' libreoffice

它将删除:

代码语言:javascript
复制
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

代码语言:javascript
复制
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
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/527627

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档