fork(10) download
  1. #!/bin/bash
  2. s="define service{
  3. host_name A
  4. notification_period F
  5. }
  6.  
  7.  
  8. define service{
  9. host_name A
  10. notification_period metrologie
  11. notification_period F
  12. }"
  13.  
  14. sed '/metrologie/{N;/\n.*notification_period/{s/\n.*//}}' <<< "$s"
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
define service{
    host_name               A
    notification_period     F
    }


    define service{
    host_name               A
    notification_period     metrologie
}