Usando awk
$ awk '/TRAP-TYPE/ {print $1; exit}' foo
Nota
Isso só funcionará se houver apenas um único campo antes de TRAP-TYPE
como no caso de OPs
Exemplo
$ cat foo
sCSISmart5 TRAP-TYPE
ENTERPRISE cyclone
VARIABLES {cycHostAdapterNumber, cycHostAdapterID, cycManagerID}
DESCRIPTION
"The HostAdapter# %d has new HostAdapter Id %s and Manager Id %s"
--#TYPE "Host Adapter changed"
--#SUMMARY "The HostAdapter# %d has new HostAdapter Id %s and Manager Id %s"
--#ARGUMENTS {0,1,2}
--#SEVERITY CRITICAL
--#TIMEINDEX 100
--#STATE OPERATIONAL
--#HELP "scsismrt.hlp"
--#HELPTAG 109
::= 109
--This Trap is issued when a Host adapter fails.
sCSISmart6 TRAP-TYPE
ENTERPRISE cyclone
VARIABLES {cycHostAdapterNumber}
DESCRIPTION
"The HostAdapter# %d has Failed"
--#TYPE "Host adapter failed"
--#SUMMARY "The HostAdapter# %d has Failed"
--#ARGUMENTS {0}
--#SEVERITY CRITICAL
--#TIMEINDEX 100
--#STATE OPERATIONAL
--#HELP "scsismrt.hlp"
--#HELPTAG 110
::= 110
$ awk '/TRAP-TYPE/ {print $1; exit}' foo
sCSISmart5