awk help

I have a raw data with some formats:

  • 11 REPT:CELL 55 ASSEMBLAGE 1 ALARM SCANNING
    SCAN POINT: ALARM GROUP 2, ALARM ID 11
    ALARM: RECTIFIER MINOR ALARM
    STATE: OFF NORMAL

    11 REPT:CELL 55 ASSEMBLAGE 1 ALARM SCANNING
    SCAN POINT: ALARM GROUP 2, ALARM ID 11
    ALARM: RECTIFIER MINOR ALARM
    STATE: NORMAL

I wrote a awk script following:

BEGIN{
cell = "";
state = "";
alarm = "";}
/ [0-5][0-9] REPT:CELL/&&/ALARM SCANNING/{
cell = $3;
next;}
/\* [0-5][0-9] REPT:CELL/&&/ALARM SCANNING/{
#printf ("CELL %s",$4) >> "alrm";
next;}
/ALARM:/{
alarm = $0;
next;}
/STATE: OFF NORMAL/{
state = "ON";
next;}
/STATE: NORMAL/{
state = "OFF";
next;}
END{
pintf("%s %s %s\n",cell,state,alarm) >> "alrm";}

But in the created "alrm" file, I only got one row.

55 OFF ALARM: RECTIFIER MINOR ALARM

How can I get more row in "alrm" file ?

Show us the desired output.

Regards

I've already told

In the "alrm" file ( output file ), I only get one row for results. I mean I only get data for last event.

55 OFF ALARM: RECTIFIER MINOR ALARM

Once again.... Pls post the desired output based on the sample input given.
Describe in plain English the algorithm.
Post the the sample using the

```text
 and 
```

code tags. More on vB code tags is here.