dagigg
February 13, 2010, 9:40am
1
hi guys,
i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB
MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00
MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00
this the file raw format:
Number of Available TCHs (1,16) 26/01/2010 01:00:00+00:00 bts {26 18 0} {bts:26-18_MARWA1} 90 BSS:26/SCANBTS:0 60 1 3 0 0 0 0 0.00 22 22 22.00
Number of Available TCHs (1,16) 26/01/2010 01:00:00+00:00 bts {26 18 1} {bts:26-18_MARWA2} 90 BSS:26/SCANBTS:0 60 1 3 0 0 0 0 0.00 22 22 22.00
I used awk to parse the out put but I couldn't get them all in one line,
cat $FileToPars| grep "Number of Available TCHs" | awk -F_ '{print $2}'
how to trim the "}" letter to get "MARWA1" ?
dagigg
February 13, 2010, 10:54am
3
\# cat $FileToPars| grep "Mean number of busy TCHs" | awk -F_ '{ [print sub("}","",$2)}'
awk: syntax error near line 1
danmero
February 13, 2010, 11:03am
4
awk -F'[_ }\/]' '/Number of Available TCHs/{print $16,$19,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31}' OFS="," infile
dagigg
February 13, 2010, 2:00pm
5
no change it gives just comas ,,,,,, still not wroks......
anbu23
February 13, 2010, 2:37pm
6
awk -F_ '{ sub("}","",$2); print $2 } '
dagigg
February 13, 2010, 2:48pm
7
I did it in a hard way.... so far it is works , but not public function
awk -F_ '/Number of Available TCHs/{print $2}' BR90_26.20100126000000+0000.20100126010000+0000-000.ASCII | awk -F} '{print $1 $2}' | awk '{print $1 " BSS:26 " " " $5 " " $6 " " $7 " "$8}'