Hey Guys.I am a newbie on Bash Shell Scripting and Perl.And I have a question about file parsing.
I have a log file which contains reports about a communication device.I need to take some of the reports from the log file.Its hard to explain the issue.but shortly I can say that, the reports has a unique report no. and this report number is located at the 2nd or 3rd line and at the end of the report.How can I parse these reports?(I need all of the lines like below.)
It is very important for me.I am waiting for your fast response
Thanking you in advanced
A tiny part of he log file:
INITSX1 2008-02-07 15:45:52 TH
00048 00000000 M147AA03 M1SNSK04
ANOMALY REPORT
ERROR TYPE 1531 CS\_MW\_COMM_FLT SYSTEM REPORT
\-------------------------------------------------------------------------
45:52:07 NA = 0435
ERCLAS SEQ RLVL FMM PROC CS : IP USERDATA
NOTIFY 18 NONE 5005 AA30 15A8:9379 80 A0 12 24 FF FF FF FF 00 00
UNSOLICITED REPORT NO = 00048
INITSX1 2008-02-07 15:46:00 TH
PSW001 0130/000C/0005
SEQ=7734\+2007-12-31 00104 00000000 M147AA03 M1SNSK04
SWA-CE LOAD
ACTIVATE-CEOVLD-OBSERV SUCCESSFUL
RESULT PART 0001 \-
\-------------------------------------------------------------------------
REQUESTED START TIME: = 15:30
REQUESTED STOP TIME : = 15:45
PERIOD: = 00:15
NO PROCESSORS IN OVERLOAD
REPORT FOLLOWS NO = 00104
INITSX1 2008-02-07 15:46:07 TH
00048 00000000 M147AA03 M1SNSK04
ANOMALY REPORT
ERROR TYPE 1531 CS\_MW\_COMM_FLT SYSTEM REPORT
\-------------------------------------------------------------------------
46:07:01 NA = 8402
ERCLAS SEQ RLVL FMM PROC CS : IP USERDATA
NOTIFY 18 NONE 5005 E430 15A8:9379 C0 9D 12 24 FF FF FF FF 00 00
UNSOLICITED REPORT NO = 00048
INITSX1 2008-02-07 15:46:20 TH
00048 00000000 M147AA03 M1SNSK04
ANOMALY REPORT
ERROR TYPE 1530 CS\_S12\_UX\_AU_FLT SYSTEM REPORT
\-------------------------------------------------------------------------
46:20:08 NA = C21F
ERCLAS SEQ RLVL FMM PROC CS : IP USERDATA
NOTIFY 10 NONE 5005 AA30 15A8:9379 80 A4 F1 01 2E 02 06 04 00 00
UNSOLICITED REPORT NO = 00048
INITSX1 2008-02-07 15:46:21 TH
00048 00000000 M147AA03 M1SNSK04
ANOMALY REPORT
ERROR TYPE 1531 CS\_MW\_COMM_FLT SYSTEM REPORT
\-------------------------------------------------------------------------
46:21:02 NA = C600
ERCLAS SEQ RLVL FMM PROC CS : IP USERDATA
NOTIFY 18 NONE 5005 0230 15A8:9379 10 A7 12 24 FF FF FF FF 00 00
UNSOLICITED REPORT NO = 00048
INITSX1 2008-02-07 15:46:31 TH
05758 00000000 M147AA03 M1SNSK04
SWA-ORJ-MEAS REPORTING
WARNING
\-------------------------------------------------------------------------
FILE READY FOR COPY ON TAPE - START FORMAT COMMAND
CALLTYPE LOG LOG NBR NBR REC
FILE DEV AVAIL USED SIZE
RECS RECS
\---------------------------------------------------------------
CELOBS 4553 1032 40 40 2048
UNSOLICITED REPORT NO = 05758
I want to parse the reports like in red.I need to take different reports as well.In the log file there is more than one report for each report types.I mean;some of the reports are taken every 15 minute.Some of them are hourly and log file contains the reports for 2-3 days.And it means that I should have more than one reports for each report types.
The issue is a little bit hard.Any suggestion is welcome for me.I appriciate for your helps.