Hey all (long time), have a file with the following on each line (file is 10,000,000 lines per day):
"7605551212","17045551212","8665551212","context","17045551212","SIP/5060-f5dd3250","","Context","17045551212","2008-10-08 07:46:41","2008-10-08 07:46:41","2008-10-08 07:47:37",56,56,"ANSWERED","DOCUMENTATION"
So I've done the following to parse out what I need:
for i in `cat zero_outcheck`
do
grep $i /var/log/asterisk/cdr-csv/Master.csv |grep 2008-10-07|\
sed '/^"",/d;s/",/"@@/g;s/"//g'|\
awk -F@@ '{printf ("%-30s %-12s %-22s %-22s %-8s \n", $1,$2,$9,$11,$12)}'|\
awk '{printf ("%-22s %-22s %-22s %-22s %-22s %-22s \n", $1,$2,$3,$4,$5,$7)}'
done
Which yields:
7605551212 17045551212 17045551212 2008-10-08 07:46:41 07:47:37
Which is all I care about seeing however I'd like to sum the time: $5, $6 but am stumped about proceeding to have output as:
7605551212 17045551212 17045551212 2008-10-08 07:46:41 07:47:37 56
where 56 is 56 seconds
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
"7605551212","17045551212","8665551212","context","17045551212","SIP/5060-f5dd3250","","Context","17045551212","2008-10-08 07:46:41","2008-10-08 07:46:41","2008-10-08 07:47:37",56,56,"ANSWERED","DOCUMENTATION"
So I've done the following to parse out what I need:
for i in `cat zero_outcheck`
do
grep $i /var/log/asterisk/cdr-csv/Master.csv |grep 2008-10-07|\
sed '/^"",/d;s/",/"@@/g;s/"//g'|\
awk -F@@ '{printf ("%-30s %-12s %-22s %-22s %-8s \n", $1,$2,$9,$11,$12)}'|\
awk '{printf ("%-22s %-22s %-22s %-22s %-22s %-22s \n", $1,$2,$3,$4,$5,$7)}'
done
Which yields:
7605551212 17045551212 17045551212 2008-10-08 07:46:41 07:47:37
Which is all I care about seeing however I'd like to sum the time: $5, $6 but am stumped about proceeding to have output as:
7605551212 17045551212 17045551212 2008-10-08 07:46:41 07:47:37 56
where 56 is 56 seconds
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'