I want to do an AWK-style range regex like this:
awk ' /hoststatus/,/\}/' file
In AWK this would print all the lines between the two patterns in a file:
hoststatus {
host_name=myhost
modified_attributes=0
check_command=check-host-alive
check_period=24x7
notification_period=workhours
check_interval=5.000000
retry_interval=1.000000
event_handler=
}
How do I do that in Ruby?
Bonus: How would you do it in Python?
This is really powerful in AWK, but I'm new to Ruby, and not sure how you'd do it. In Python I was also unable to find a solution.