codfei@ws031147:~/Desktop$ cat 1.txt
2007-11-26 18:34:33.705 - CpSpotRateInfo:[FxPriceId=20071126GSPD000050882770,CurrencyPair=ZAR/JPY,CounterpartyId=GS,MessageTime=2007-11-26 18:34:33:699,JST,usualable=true,inManualStatus=0,inEmgerencyStatus=0,--Bid:Band [0] PriceId=819245002642,Rate=15.90000,Tradable=true,ContractCurrency=ZAR,LowerAmount=0,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=0,UpperAmount=15900000.00000;Band [1] PriceId=819245002642,Rate=15.89000,Tradable=true,ContractCurrency=ZAR,LowerAmount=1000000,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=15900000.00000,UpperAmount=15890000.00000;Band [2] PriceId=819245002642,Rate=15.88000,Tradable=true,ContractCurrency=ZAR,LowerAmount=1000000,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=15890000.00000,UpperAmount=15880000.00000;Band [3] PriceId=819245002642,Rate=15.87000,Tradable=true,ContractCurrency=ZAR,LowerAmount=1000000,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=15880000.00000,UpperAmount=15870000.00000;--Ask:Band [0] PriceId=819244002583,Rate=16.04000,Tradable=true,ContractCurrency=ZAR,LowerAmount=0,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=0,UpperAmount=16040000.00000;Band [1] PriceId=819244002583,Rate=16.05000,Tradable=true,ContractCurrency=ZAR,LowerAmount=1000000,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=16040000.00000,UpperAmount=16050000.00000;Band [2] PriceId=819244002583,Rate=16.06000,Tradable=true,ContractCurrency=ZAR,LowerAmount=1000000,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=16050000.00000,UpperAmount=16060000.00000;Band [3] PriceId=819244002583,Rate=16.07000,Tradable=true,ContractCurrency=ZAR,LowerAmount=1000000,UpperAmount=1000000;CounterCurrency=JPY,LowerAmount=16060000.00000,UpperAmount=16070000.00000;]
codfei@ws031147:~/Desktop$ awk -F, '{print $1}{ for (i = 1; i <= NF; i++) if ($i~/ CurrencyPair=/ || $i~/CounterpartyId/ ) print $i};{ for (r=1;r<=NF;r++) if ($r~/ Bid/||$r~/Ask/) print $(r+1)}' 1.txt |sed 's/ - CpSpotRateInfo.*//g' |sed 'N;N;N ;N;s/\n/,/g' |awk -F , '{print $1,$2,$3,"BID:" $4,"Ask:"$5}'
2007-11-26 18:34:33.705 CurrencyPair=ZAR/JPY CounterpartyId=GS BID:Rate=15.90000 Ask:Rate=16.04000
BID: Ask:
BID: Ask:
BID: Ask: