File 1
---------
N_ACCT,CARD_TYPE,CARD_BAL,CUST_CODE
---------------------------------------------------
0301,38,0.00,10
0319,38,54422.92,10
0392,38,0.00,10
0418,38,35254.87,10
0442,38,0.00,10
0491,38,0.00,10
0558,38,45988.76,10
0616,38,0.00,10
0665,38,0.00,10
0699,38,0.00,10
File 2
---------------
N_ACCT,CARD_TYPE,CARD_BAL,CUST_CODE
--------------------------------------------------
0301,38,0.00,10
0319,38,56422.92,10
0392,38,0.00,10
0418,38,38254.87,10
0442,38,0.00,10
0491,38,0.00,10
0558,38,49988.76,10
0616,38,0.00,10
0665,38,0.00,10
0699,38,0.00,10
I have to apply below logic in the script.
If IsNull(File1.CARD_BAL) Then File1.CARD_BAL/2 Else (File 1.CARD_BAL+ File2.CARD_BAL)/2.
Finally output should be in below format
----------------------------------------
N_ACCT,CARD_TYPE,CARD_BAL,CUST_CODE
0301,38,0.00,10
0319,38,54422.92,10
Since I am not familiar with UNIX, appreciate your help on this.