Hello RudiC,
Thank you for your help!
I've done some testings to see what is inside cmpAr working only with tobe file. Now I'm trying to do the comparison loop, I got error with tmp using not as
matrix, then I change the second tmp to tmp1 but the output is not correct, I get more than 2300 fields for the sample I've posted (see the output attached).
I've done this:
awk 'BEGIN {split("OCTDP TCTDP GPRSTDP",TDPAr);
print "MSISDN,OCTDP,TCTDP,GPRSTDP,GCSO,MCSO,SSLO,GC2SO,MC2SO,TIF,GPRSSO,OSMSSO,GC3SO,MC3SO,GC4SO,MC4SO,MMSO,STAT"
}
NR==FNR {cnt[NR] = split ($0, tmp, ","); for (i=1;i<=cnt[NR]; i++) cmpAr[NR,i]=tmp; Cn++; next}
/^MSISDN/ {getline; rec=$0}
/^TDPTYPE/ {noflds=0
while (1)
{getline; if ($0 ~ /^$/) break
OFS="|"; tmp1=$1; $1=""; sub("\|",""); tmpAr[tmp1]=$0; noflds=3 ;
}
for (i=1; i<=noflds; i++) rec=rec","tmpAr[TDPAr]
}
/^(GCSO|GC3SO|MMSO)/ {
getline; OFS=","; $1=$1; rec=rec","$0}
/^NONE/ {getline; rec=rec ",no values"}
/END/ {split (rec, tmpAr, ","); rec=tmpAr[1]
for (i=1;i<=Cn;i++) for (j=2;j<=cnt;j++) {if (tmpAr != cmpAr[i,j]) {tmpAr=tmpAr"_I"; dif=1} rec=rec","tmpAr}
if (dif) rec=rec",different"
print rec; rec=""; delete tmpAr; dif=0}
' tobe file
Almost sure that the problem is they way I'm doing the comparison loop, but I can't see the problem.
Any help would be very appreciated.
Regards
