awk help

Hi

I have a following entries in a file

CLASS  mmlUnexpectedDisconnect
  SELECT
     msg = PRINTF("Logger %s: got Unexpected disconnect. Trap Severity = %s, mml Name = %s, mml Status = %s",  $V8, $V4, $V5, $V6);
END
CLASS  mmlConnectionCanNotBeEstablished
  SELECT
     msg = PRINTF("Logger %s: failed to open connection. Trap Severity = %s, mml Name = %s, mml Status = %s",  $V8, $V4, $V5, $V6);
END
CLASS  mmlAllConnectionResourcesInUse
  SELECT
     msg = PRINTF("All %s Logger connection resources in use. Trap Severity = %s, mml Name = %s, mml Status = %s",  $V8, $V4, $V5, $V6);
END

I want to just get the following using awk

mmlUnexpectedDisconnect
mmlConnectionCanNotBeEstablished
mmlAllConnectionResourcesInUse

How to do it?

Thanks for any help.

Regards,
Din

---------- Post updated at 05:39 PM ---------- Previous update was at 05:20 PM ----------

Hi

I tried this

cat nice.txt | awk '/^CLASS/ {print $0}'

but still I am not able to evade the CLASS variable

How to remove the CLASS

Thanks & Regards,
Din

---------- Post updated at 05:42 PM ---------- Previous update was at 05:39 PM ----------

Hi Friends,

After joining this forum I am slowly picking up in awk

cat nice.txt | awk '/^CLASS/ {print $2}'

I am able to fix this.

Feel very happy.

Thanks
Din

awk '/^CLASS/{print $NF}' infile
1 Like