我正在运行 yum 查询
yum group info 'X Window System'
输出如下
yum group info 'X Window System'
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.vanehost.com
* extras: mirror.vanehost.com
* updates: mirror.vanehost.com
Group: X Window System
Group-Id: x11
Description: X Window System Support.
Mandatory Packages:
-glx-utils
-initial-setup-gui
=mesa-dri-drivers
=plymouth-system-theme
=spice-vdagent
+xorg-x11-drivers
=xorg-x11-server-Xorg
=xorg-x11-utils
=xorg-x11-xauth
=xorg-x11-xinit
=xvattr
Optional Packages:
mesa-libGLES
tigervnc-server
wayland-protocols-devel
xorg-x11-drv-evdev
xorg-x11-drv-keyboard
xorg-x11-drv-libinput
xorg-x11-drv-mouse
xorg-x11-drv-openchrome
但是当我对此运行 grep 来过滤掉以 - 或 + 开头的行时
yum group info 'X Window System' | grep -E "^[-+]"
我得到一个空白输出。有人可以让我知道我哪里出了问题吗?
答案1
这些行不以+
或开头-
,而是以空格开头。尝试
grep -E "^[[:blank:]]*[-+]"