Register
It is currently Wed Oct 22, 2014 5:07 pm

Extract information from code block


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Wed Jul 31, 2013 1:20 pm   

Joined: Wed Jul 13, 2011 8:43 am
Posts: 3
I"m trying to extract certain parts of a block of configuration options (from Nagios) but not sure the best way to do it, I'm sure I could do it with regex, just can't get it to work :(

This is the (shortened) syntax of what I'm working with:

Code:
hoststatus {
        host_name=host1
        modified_attributes=0
        check_command=check-host-alive
        check_period=24x7
        notification_period=24x7
        has_been_checked=1
        notifications_enabled=0
}

servicestatus {
        host_name=host1
        service_description=McAfee DAT Date
        modified_attributes=0
        check_command=check_windows_nrpe!check_av
        check_period=24x7
        notification_period=24x7
        notifications_enabled=0
}


I want to extract certain lines, like host_name,service_description (if it's a servicestatus) depending on certain conditions, i.e. notifications_enabled=0.

Any ideas appreciated :)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP