#!/bin/bash
awk '/^edit / {
   rec = 1
   s = $0
   next
}
rec {
   s = s ORS $0
}
/^next/ {
   if (s ~ /set associated-interface "interface1"/)
      print s
   rec = 0
}'
