Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP NAWK AND IF

Status
Not open for further replies.

budimanonly

Technical User
May 22, 2005
10
SG
Dear All,

I have a file like this :

----------------------------------------
ES name: LABSC02
Report id: 43
Time: Thu Jun 2 17:46:57 2005
User: bbudiman
Application: SRM
----------------------------------------

*** ALARM 095 A3/APT "VLABSC0230R91A0"A 050602 1744
CELL LOGICAL CHANNEL AVAILABILITY SUPERVISION
CELL SCTYPE CHTYPE CHRATE SPV
LG620D2 BCCH
END





----------------------------------------
ES name: LABSC02
Report id: 43
Time: Thu Jun 2 17:59:05 2005
User: bbudiman
Application: SRM
----------------------------------------

*** ALARM CAEASING 095 A3/APT "VLABSC0230R91A0"A 050602 1750
CELL LOGICAL CHANNEL AVAILABILITY SUPERVISION
CELL SCTYPE CHTYPE CHRATE SPV
LG620D2 BCCH
END


----------------------------------------



And the output will be :

LABSC02 LG620D2 ALARM 050602 1744
LABSC02 LG620D2 ALARM CAEASING 050602 1750


(LABSC02 is taken from ES name, "ALARM" and "ALARM CEASING" is taken after "***" character, "050602 1744" is the alarm date and "050602 1750" is the ceasing alarm.

Is there anobody can help.
BR,
Budiman







 
Something like this ?
nawk '
/^ES name:/{l=$NF}
/^\*\*\* ALARM/{d=$(NF-1)" "$NF;a=$2($3~/^CAE/?" "$3:"")}
$2=="BCCH"{printf "%-7s %-7s %-14s %s\n",l,$1,a,d}
' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top