I have a file with below lines. All the services with same definition like below. I have print host name and service description if the given string matches with contact\_groups

For example: if i give the string contact\_groups as sunil, it should print Service\_description and host\_name. Any suggestions on this

```
  define service {
  service_description            xvy
  host_name                      abc
  use                            generic-service
  check_command                  checkCertificate!443!
  check_interval                 1440
  contact_groups                 sunil 
   retry_interval                 1440
   servicegroups                  def
  }

```

i am using the below cod. But not working

```
awk '/sunil/{nr[NR-4]}; NR in nr' test.cfg

```