Need Help in understanding AWK script logic : <p>I need help in understanding the below code logic written in AWK by one of our collegues in the past.
Can anyone with good AWK knowledge help me to understand this code.</p>

<p>Thanks,
Sandeep</p>

<pre><code>sed -i 's/\r//g' $1 $2
sed -i 's/,/;/g' $1 $2
awk -F"|" '{if(FILENAME=="Parameter.txt"){a[$1]=NR;aa[NR]=$1;d=NR;if(NR==1){e=$1}else{e=e","$1};}
                        else if(FILENAME=="Traffic.csv"){h[FNR","$2]=$3;x[FNR","$4]=$5;k[FNR","$2","$3","$4","$5]=$1;y=FNR;}
                        else if(FILENAME=="Filter.txt"){for(i=1;i&lt;=NF;i=i+3){if($(i+1)!="ne"){FE[FNR","$i]=$(i+2)}else{FNE[FNR","$i]=$(i+2)}};FILTER=FNR;FC[FNR]=(NF/3);}
                        else{
                                if(g==""){print e",TRAFFIC_CASE";g=1};
                                for(i=1;i&lt;=d;i++){c[i]=""};l="";m="";z="";FINAL="";for(j=1;j&lt;=FILTER;j++){FI[j]=""};
                                for(i=1;i&lt;=NF;i++){
                                                                        split($i,b,"=");
                                                                        if(a[b[1]]!=""){c[a[b[1]]]=b[2];};
                                                                        for(j=1;j&lt;=y;j++){
                                                                                if(h[j","a[b[1]]]==b[2] &amp;&amp; h[j","a[b[1]]]!=""){l=a[b[1]]","b[2]};
                                                                                if(x[j","a[b[1]]]==b[2] &amp;&amp; x[j","a[b[1]]]!=""){z=a[b[1]]","b[2]};
                                                                                if(k[j","l","z]!=""){m=k[j","l","z]};};
                                                                        };
                                if(substr(FILENAME,20,3)=="SVC"){Q[c[a[MSISDN]]]=1}
                                else if(Q[c[a[MSISDN]]]!=1){
                                        for(i=1;i&lt;=d;i++){
                                                                                if(i==1){f=c[1];}else{f=f","c[i]};
                                                                                if(c[i]==""){c[i]="B"};
                                                                                for(j=1;j&lt;=FILTER;j++){
                                                                                        if(FE[j","i]!=""){if(FE[j","i]==c[i] &amp;&amp; (FI[j]=="" || FI[j]&lt;=FC[j])){FI[j]=FI[j]+1;}else{FI[j]=FI[j]-1;}};
                                                                                        if(FNE[j","i]!=""){if(FNE[j","i]!=c[i] &amp;&amp; (FI[j]=="" || FI[j]&lt;=FC[j])){FI[j]=FI[j]+1;}else{FI[j]=FI[j]-1;}};
                                                                                        };
                                                                                };
                                                                        }
                                for(j=1;j&lt;=FILTER;j++){if(FI[j]==FC[j]){FINAL=1};};
                                if(FINAL!=1){print f","m;};
                                };
                        }' Parameter.txt Traffic.csv Filter.txt $2 $1
</code></pre>
