I'm not convinced I fully understand what you are after, but using the assumption that the text in between hashes is one line, have a look at this:
[code]
use strict;
while (<DATA>) {
chomp;
my $line=$_;
if ($line=~m/^\#$/) {
next;
} elsif ($line=~m/\"Status Events\"\s(\w*)\s/) {
if ($1 eq 'MINOR') {
#$line=~s/\$R TRAP 1 \"A SNTP Server was configured, but no SNTP servers were found. \$*\"/\$R TRAP 0 \"Status Events\" MINOR/;
$line=~s/TRAP 1 \"A SNTP Server was configured, but no SNTP servers were found. \$\*\"/TRAP 0 "Status Events" MINOR/;
print "$line\n";
} elsif ($1 eq 'CRITICAL') {
$line=~s/TRAP 1 \"Primary enclosure temperature critical!. \$\*\"/TRAP 2 "Status Events" CRITICAL/;
print "$line\n";
} elsif ($1 eq 'WARNING') {
$line=~s/TRAP 1 \"Primary enclosure temperature warning. \$\*\"/TRAP 1 "Status Events" WARNING/;
print "$line\n";
}
}
}
__DATA__
#
EVENT switchSNTPServiceUnavailable .1.3.6.1.4.1.232.0.161015 "Status Events" MINOR FORMAT A SNTP Server was configured, but no SNTP servers were found. $*EXEC /usr/libexec/submit_check_result_via_nsca $R TRAP 1 "A SNTP Server was configured, but no SNTP servers were found. $*" SDESC A SNTP Server was configured, but no SNTP servers were found.
#
#
#
EVENT cpqCrEMUTemperatureCriticalTrap .1.3.6.1.4.1.232.141.3.7.0.24 "Status Events" CRITICAL FORMAT Primary enclosure temperature critical!. $*EXEC /usr/libexec/submit_check_result_via_nsca $R TRAP 1 "Primary enclosure temperature critical!. $*" SDESC Primary enclosure temperature critical!.
#
#
#
EVENT cpqCrEMUTemperatureCriticalTrap .1.3.6.1.4.1.232.141.3.7.0.24 "Status Events" WARNING FORMAT Primary enclosure temperature critical!. $*EXEC /usr/libexec/submit_check_result_via_nsca $R TRAP 1 "Primary enclosure temperature warning!. $*" SDESC Primary enclosure temperature critical!.
#