How: If line starting with X AND next lines containing Y have column $4 == "Missing"

How: If line starting with X AND next lines containing Y have column $4 == "Missing"
0

Trying to do something like this to set a RAID name when there isn’t one
#! PARSER::AWK

Trying to get a raid_name to be “RAID=No” if one of the subordinate disk id’s has a state of Missing

If all drives are not missing then the raid_name should be the Pair name or “Overall RAID status (aka $0)”

If a Disk Pair has a missing disk id state then that Disk Pair or not configuredshould not alert

examples:

#Disk Pair A Available

Disk id A1 Present

Disk id A2 Present


#Overall RAID status Good
#--------------------------------------------------------------------------------
#Drive status

Disk id 1 Present

Disk id 2 Missing

#Overall RAID status Good
#--------------------------------------------------------------------------------
#Drive status

Disk id 1 Present

Disk id 2 Present

/ Pair|Overall / {
line = $0
sub(/Disk id/, “”, line)
if (($0 ~/^Overall/) && ((/Disk id/)$4 == “Missing”)) {
raid_name = “RAID=No”
} else {
raid_name = line
}
}
Collapse
Missing means that RAID isn’t confgured. So how can I look further to Disk id and if it is Missing set the raid_name to RAID=No? Example or reference appreciated. thanks!