Quote:
Originally Posted by druuna
You keep repeating the same question, which I already answered, twice....
I'll repeat for a third time:
Without knowing what your exact task is and what the input data represents I'm not even capable of giving you a hint on how to start.
|
Ans:
in the script:
part of code
Code:
#!/bin/ksh
cd /home/www/BCARD/data/dcp
rm -rf ./pay_dt.txt ./pay_dt1.txt ./DCP-hourly* ./CCCD-hourly* ./KIVR-hourly* ./AS_hourly_pay1*
user=biscsi
dt=`date '+%d%m%y'`
tody=`ksh today`
scp $user@picard.barclaycard.co.uk:/u/epayadm/log/audit.log ./
scp $user@picard.barclaycard.co.uk:/u/epayadm/log/audit$tody.log ./
cat ./audit.log ./audit$tody.log > ./audit1.tmp
sed 's/^/20/g' ./audit1.tmp > ./audit.tmp
for i in `cat ./channel | awk '{print $1}'`
do
fname=`egrep $i ./channel | awk '{print $2}'`
awk -F',' '{print substr($1,0,10),$14,$10,$11}' ./audit.tmp | awk '($2=='000')' | egrep "$i" | awk '{print $1}' | sort | uniq -c > ./$fname-hourly-pay1a.txt
awk -F',' '{print substr($1,0,10),$14,$10,$11}' ./audit.tmp | awk '($2!='000')' | egrep "$i" | awk '{print $1}' | sort | uniq -c > ./$fname-hourly-pay1d.txt
done
Sample of audit.log (First Column is date with HHMMSS):
131219000106,131219000110,100,033536,492181******6214,,,1609,MERCHANT-DECLINE,2000,2893907,826,826,106,8,00,CV2100,8,2,4,4,1,1,1,1
131219000116,131219000119,200,033460,492181******7018,,,1510,019405,15000,4451746,826,826,000,8,00,C V2200,8,2,2,2,1,1,1,1
131219000201,131219000204,100,033481,475130******4811,,,1603,703102,17000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219000204,131219000206,200,033528,475117******9618,,,1512,689211,21534,4451746,826,826,000,8,00,C V2200,8,2,2,2,1,1,1,1
131219000242,131219000244,100,033537,475130******3807,,,1503,637115,2745,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219000419,131219000423,100,033461,476367******6518,,,1406,MERCHANT-DECLINE,916,2893907,826,826,106,8,00,CV2100,8,2,4,4,1,1,1,1
131219000525,131219000528,100,033529,465902******1018,,,1610,052662,21165,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219000600,131219000602,200,033622,454742******3999,,,1510,DECLINE,689135,4451746,826,826,002,4,00 ,CV2200,8,2,2,2,,,,
131219000645,131219000648,100,033632,465921******9208,,,1702,064741,22000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219000749,131219000752,100,033530,453978******7407,,,1702,075101,6000,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219000815,131219000818,100,033538,465942******7993,,,1502,003529,10000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219000827,131219000830,100,033539,446291******8627,,,1510,019809,11741,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219000844,131219000847,100,033623,475130******6968,,,1608,058367,3000,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219000912,131219000916,200,033531,476367******6518,,,1406,MERCHANT-DECLINE,916,4451746,826,826,106,8,00,CV2200,8,2,4,4,1,1,1,1
131219001101,131219001104,100,033624,446291******8517,,,1601,019988,117215,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
131219001113,131219001116,200,033692,476367******6518,,,1406,019879,916,4451746,826,826,000,8,00,CV2 200,8,2,4,4,1,0,0,0
131219001206,131219001209,100,033540,465942******6460,,,1609,002693,20000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219001215,131219001218,100,033625,492181******2146,,,1407,019639,4757,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219001234,131219001237,100,033633,475117******5299,,,1504,767330,26000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219001542,131219001544,100,033626,453979******5403,,,1611,054361,5000,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219001618,131219001621,100,033634,475117******0721,,,1512,495115,13936,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219002109,131219002112,100,033627,475130******7734,,,1605,771357,20000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219002119,131219002122,100,033635,475129******8345,,,1507,300734,100000,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
131219002158,131219002201,100,033693,454313******0425,,,1807,299696,19090,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219002345,131219002349,100,033636,475714******6784,,,1411,427560,10000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219002618,131219002621,100,033628,475714******1535,,,1606,580350,5771,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219002634,131219002637,100,033637,453979******7323,,,1510,063628,16599,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219002734,131219002737,100,033629,475127******4127,,,1601,765813,20676,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219003212,131219003214,100,033541,465901******8002,,,1604,021378,37500,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219003305,131219003308,100,033630,475130******9122,,,1402,730113,279679,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
131219003358,131219003400,100,033638,475117******4818,,,1503,475470,15000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219003618,131219003621,100,033639,475130******9122,,,1402,778065,10000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219003723,131219003726,100,033640,454742******1310,,,1505,245030,139666,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
131219003742,131219003745,100,033694,475129******7186,,,1312,212701,58356,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219003806,131219003809,100,033912,465860******3103,,,1402,080788,17580,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219003904,131219003907,100,033631,475128******4682,,,1605,025236,1927,2893907,826,826,000,8,00,CV 2100,8,2,2,2,1,1,1,1
131219004613,131219004616,100,033641,465859******2101,,,1502,061473,10000,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
131219004628,131219004631,100,034012,675922******7662,,0412,1501,479800,4397,2893907,826,826,000,8,0 0,CV2100,8,2,2,2,1,1,1,1
131219004704,131219004707,100,034022,475116******1794,,,1407,413400,10175,2893907,826,826,000,8,00,C V2100,8,2,2,4,1,1,1,1
131219004730,131219004733,100,033695,465901******9016,,,1502,MERCHANT-DECLINE,60000,2893907,826,826,106,8,00,CV2100,8,2,4,4,1,1,1,1
131219005010,131219005013,200,034023,446272******4036,,,1510,019556,4397,4451746,826,826,000,8,00,CV 2200,8,2,2,2,1,1,1,1
131219005102,131219005105,100,034013,492182******9664,,,1505,019836,268847,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
131219005745,131219005747,100,033913,475132******2962,,,1502,581696,10156,2893907,826,826,000,8,00,C V2100,8,2,2,2,1,1,1,1
in the present script this data is redirecting it to audit.tmp
now the data available in audit.tmp(First column is date with HHMMSS) is:
20131219000106,131219000110,100,033536,492181******6214,,,1609,MERCHANT-DECLINE,2000,2893907,826,826,106,8,00,CV2100,8,2,4,4,1,1,1,1
20131219000116,131219000119,200,033460,492181******7018,,,1510,019405,15000,4451746,826,826,000,8,00 ,CV2200,8,2,2,2,1,1,1,1
20131219000201,131219000204,100,033481,475130******4811,,,1603,703102,17000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219000204,131219000206,200,033528,475117******9618,,,1512,689211,21534,4451746,826,826,000,8,00 ,CV2200,8,2,2,2,1,1,1,1
20131219000242,131219000244,100,033537,475130******3807,,,1503,637115,2745,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219000419,131219000423,100,033461,476367******6518,,,1406,MERCHANT-DECLINE,916,2893907,826,826,106,8,00,CV2100,8,2,4,4,1,1,1,1
20131219000525,131219000528,100,033529,465902******1018,,,1610,052662,21165,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219000600,131219000602,200,033622,454742******3999,,,1510,DECLINE,689135,4451746,826,826,002,4, 00,CV2200,8,2,2,2,,,,
20131219000645,131219000648,100,033632,465921******9208,,,1702,064741,22000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219000749,131219000752,100,033530,453978******7407,,,1702,075101,6000,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219000815,131219000818,100,033538,465942******7993,,,1502,003529,10000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219000827,131219000830,100,033539,446291******8627,,,1510,019809,11741,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219000844,131219000847,100,033623,475130******6968,,,1608,058367,3000,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219000912,131219000916,200,033531,476367******6518,,,1406,MERCHANT-DECLINE,916,4451746,826,826,106,8,00,CV2200,8,2,4,4,1,1,1,1
20131219001101,131219001104,100,033624,446291******8517,,,1601,019988,117215,2893907,826,826,000,8,0 0,CV2100,8,2,2,2,1,1,1,1
20131219001113,131219001116,200,033692,476367******6518,,,1406,019879,916,4451746,826,826,000,8,00,C V2200,8,2,4,4,1,0,0,0
20131219001206,131219001209,100,033540,465942******6460,,,1609,002693,20000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219001215,131219001218,100,033625,492181******2146,,,1407,019639,4757,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219001234,131219001237,100,033633,475117******5299,,,1504,767330,26000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219001542,131219001544,100,033626,453979******5403,,,1611,054361,5000,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219001618,131219001621,100,033634,475117******0721,,,1512,495115,13936,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219002109,131219002112,100,033627,475130******7734,,,1605,771357,20000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219002119,131219002122,100,033635,475129******8345,,,1507,300734,100000,2893907,826,826,000,8,0 0,CV2100,8,2,2,2,1,1,1,1
20131219002158,131219002201,100,033693,454313******0425,,,1807,299696,19090,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219002345,131219002349,100,033636,475714******6784,,,1411,427560,10000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219002618,131219002621,100,033628,475714******1535,,,1606,580350,5771,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219002634,131219002637,100,033637,453979******7323,,,1510,063628,16599,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219002734,131219002737,100,033629,475127******4127,,,1601,765813,20676,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219003212,131219003214,100,033541,465901******8002,,,1604,021378,37500,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219003305,131219003308,100,033630,475130******9122,,,1402,730113,279679,2893907,826,826,000,8,0 0,CV2100,8,2,2,2,1,1,1,1
20131219003358,131219003400,100,033638,475117******4818,,,1503,475470,15000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219003618,131219003621,100,033639,475130******9122,,,1402,778065,10000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219003723,131219003726,100,033640,454742******1310,,,1505,245030,139666,2893907,826,826,000,8,0 0,CV2100,8,2,2,2,1,1,1,1
20131219003742,131219003745,100,033694,475129******7186,,,1312,212701,58356,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219003806,131219003809,100,033912,465860******3103,,,1402,080788,17580,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219003904,131219003907,100,033631,475128******4682,,,1605,025236,1927,2893907,826,826,000,8,00, CV2100,8,2,2,2,1,1,1,1
20131219004613,131219004616,100,033641,465859******2101,,,1502,061473,10000,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
20131219004628,131219004631,100,034012,675922******7662,,0412,1501,479800,4397,2893907,826,826,000,8 ,00,CV2100,8,2,2,2,1,1,1,1
20131219004704,131219004707,100,034022,475116******1794,,,1407,413400,10175,2893907,826,826,000,8,00 ,CV2100,8,2,2,4,1,1,1,1
20131219004730,131219004733,100,033695,465901******9016,,,1502,MERCHANT-DECLINE,60000,2893907,826,826,106,8,00,CV2100,8,2,4,4,1,1,1,1
20131219005010,131219005013,200,034023,446272******4036,,,1510,019556,4397,4451746,826,826,000,8,00, CV2200,8,2,2,2,1,1,1,1
20131219005102,131219005105,100,034013,492182******9664,,,1505,019836,268847,2893907,826,826,000,8,0 0,CV2100,8,2,2,2,1,1,1,1
20131219005745,131219005747,100,033913,475132******2962,,,1502,581696,10156,2893907,826,826,000,8,00 ,CV2100,8,2,2,2,1,1,1,1
==============
now this file audit.tmp is used every where in the script.