[Nagiosplug-help] check_apt: I don't understand the regex

Tony Yarusso tyarusso at nagios.com
Wed Apr 6 22:03:55 CEST 2011


On 4/6/2011 6:31 AM, Frank Van Damme wrote:
> Hello list,
>
> according to the man page of check_apt, a package is considered a
> critical upgrade if it matches this regex:
>
> ^[^\(]*\([^ ]* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)
>
> I know a few things about regexes but I can't parse it. And so can't grep:
>
> # apt-get -o 'Debug::NoLocking=true' -s -qq upgrade | grep
>   '^[^\(]*\([^ ]* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)'
> grep: Unmatched ( or \(
>
> What am I misinterpreting?
The options to grep.  Your regex is perfect.  You need to run grep in 
"Extended regexp" mode, with the -E (or --extended-regexp) switch, like so:

apt-get -o 'Debug::NoLocking=true' -s -qq upgrade | grep -E '^[^\(]*\([^ 
]* (Debian-Security:|Ubuntu:[^/]*/[^-]*-security)'

-- 
Tony Yarusso
Technical Team
___
Nagios Enterprises, LLC
Email:  tyarusso at nagios.com
Web:    www.nagios.com





More information about the Help mailing list