yum 명령 출력에서 ​​- 또는 더하기로 시작하는 grep 행

yum 명령 출력에서 ​​- 또는 더하기로 시작하는 grep 행

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:]]*[-+]"

관련 정보