I have a issue with my script. It works for the most part but is not very
portable. Example below is sample of "input file" and cut and paste of "script.
The script works fine if The following System portions are outputted as follows:
SYSTEM CFO is followed by SYSTEM DAX
SYSTEM DAX is followed by SYSTEM TC
SYSTEM TC is followed by STETEM OND
On different Units some of the System portions are not outputted in the same
order or some of the System portions are not outputted at all.
My question is how can I modify awk functions to stop processing on one system
and start processing on the next system portion when the next system portion
is not listed in the portion itself, example of function(dAX):
Code:
while (( getline > 0 ) && ( $3 != "TC" )) {
In the above line of code, $3 TC is the next system portion, that tells function to stop processing.
Here is sample of input file:
Code:
doal cont pegc system1 call7 solh
RX SYSTEM CFO
DATE 322:47:34
DPORQ = 0 TTORQ = 0 DPINRQ= 0
MFINRQ= 0 CDIRR = 0 TCBSY = 0
TCINT = 0 TCANS = 0 TCRNG = 0
RPINRQ= 0 C6INRQ= 0 ISUPRQ= 11147
TUPRQ = 0 MFOURQ= 0 C6OURQ= 0
ISUPOR= 17417 BICCRQ= 0 BICCOR= 0
POVFL = 0
doal cont pegc system1 call7 solh
RX SYSTEM DAX
DATE 322:47:34
proc cpu systm load sactv orig ovldpu mmst
1 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0
5 0 0 0 0 0 0 0
6 0 0 0 0 0 0 0
7 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0
9 0 0 0 0 0 0 0
10 0 0 0 0 0 0 0
11 0 0 0 0 0 0 0
doal cont pegc system1 call7 solh
RX SYSTEM TC
DATE 322:47:34
proc pucco load chgro chmert chinc chout ceqpu
22 2 97 0 0 2707 6374 0
1 3 15011 0 0 2717 6651 0
2 3 12976 0 0 2139 6137 0
3 3 13898 0 0 2199 6583 0
4 3 15123 0 0 2478 7788 0
5 3 13823 0 0 2645 5789 0
Here is sample of script:
Code:
/usr/xpg4/bin/awk '
$3 == "CFO" { cFO() }
$3 == "DAX" { dAX() }
$3 == "TC" { tC() }
function dAX( _xm)
{
while (( getline > 0 ) && ( $3 != "TC" )) {
do a a lot of awk stuff here....
.
.
.
.
.
}
}
function tC( _msx)
{
while (( getline > 0 ) && ( $3 != "OND" )) {
do a a lot of awk stuff here....
.
.
.
.
.
}
}
function cFO( _iu)
{
while (( getline > 0 ) && ( $3 != "DAX" )) {
do a a lot of awk stuff here....
.
.
.
.
.
}
} FILENAME
Thanks in advance.