I'm trying to use sed to replace the output of a command with regexp but can't figure it out the problem.
I tested the regex in regex101.com and it seems fine grouping the things that I want. But I cant understand how sed work with regexp groups patterns.
Here is the command output:
appstream CentOS Linux 8 - AppStream
baseos CentOS Linux 8 - BaseOS
epel Extra Packages for Enterprise Linux 8 - x86_64
epel-modular Extra Packages for Enterprise Linux Modular 8 - x86_64
extras CentOS Linux 8 - Extras
And here is what I want to parse:
CentOS Linux 8 - AppStream
CentOS Linux 8 - BaseOS
Extra Packages for Enterprise Linux 8 - x86_64
Extra Packages for Enterprise Linux Modular 8 - x86_64
CentOS Linux 8 - Extras
The sed regexp that I came up to is this:
sed -E 's/"(^.*?\s)([A-Z|a-x].*)"/\2/g'
Can someone help me find the issue please?
Thanks!
regex101
site does not even list POSIX regular expressions in its "Flavor" list. Don't use it to test regular expressions for use with Unix command line tools (only for use with the languages actually listed on the site). – Kusalananda Mar 12 '21 at 08:31