no piping allowed
Alright, so a quick question about piping in awk...
awk 'a !~ $0; {a=$0}' (equivalent to uniq)
awk '! a[$0]++' (equivalent to uniq)
awk '/something/' (equivalent to grep something)
awk '!/something/' (equivalent to grep -v something)
So now I have a cdr file... Its normal output...
"","1001","1","fxobox","""1001"" <1001>","SIP/1001-f912","SIP/1003-c091","Dial","SIP/1003","2006-11-02 15:22:00","2006-11-02 15:22:01","2006-11-02 15:22:04",4,3,"ANSWERED","DOCUMENTATION"
[root@mybox cdr-csv]# awk -F "," '/fxobox/{print $2,$4,$10,$11}' filename
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 16:34:47" "2006-11-02 16:34:48"
[root@mybox cdr-csv]# awk -F "," '/fxobox/{print $2,$4,$10,$11;! a[$0]++;/16:34/}' filename
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 16:34:47" "2006-11-02 16:34:48"
What gives? In theory isn't this awk -F "," '/fxobox/{print $2,$4,$10,$11;! a[$0]++;/16:34/}' nothing more than the equivalent of:
awk -F "," '/fxobox/{print $2,$4,$10,$11}' filename|uniq|grep -v "16:34"
[root@mybox cdr-csv]# awk -F "," '/fxobox/{print $2,$4,$10,$11}' filename|uniq|grep -v "16:34"
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
Just curious nothing major. Just wanted to understand pipes in awk a little better. Thanks way in advance
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
Alright, so a quick question about piping in awk...
awk 'a !~ $0; {a=$0}' (equivalent to uniq)
awk '! a[$0]++' (equivalent to uniq)
awk '/something/' (equivalent to grep something)
awk '!/something/' (equivalent to grep -v something)
So now I have a cdr file... Its normal output...
"","1001","1","fxobox","""1001"" <1001>","SIP/1001-f912","SIP/1003-c091","Dial","SIP/1003","2006-11-02 15:22:00","2006-11-02 15:22:01","2006-11-02 15:22:04",4,3,"ANSWERED","DOCUMENTATION"
[root@mybox cdr-csv]# awk -F "," '/fxobox/{print $2,$4,$10,$11}' filename
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 16:34:47" "2006-11-02 16:34:48"
[root@mybox cdr-csv]# awk -F "," '/fxobox/{print $2,$4,$10,$11;! a[$0]++;/16:34/}' filename
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
"1001" "fxobox" "2006-11-02 16:34:47" "2006-11-02 16:34:48"
What gives? In theory isn't this awk -F "," '/fxobox/{print $2,$4,$10,$11;! a[$0]++;/16:34/}' nothing more than the equivalent of:
awk -F "," '/fxobox/{print $2,$4,$10,$11}' filename|uniq|grep -v "16:34"
[root@mybox cdr-csv]# awk -F "," '/fxobox/{print $2,$4,$10,$11}' filename|uniq|grep -v "16:34"
"1001" "fxobox" "2006-11-02 15:22:00" "2006-11-02 15:22:01"
Just curious nothing major. Just wanted to understand pipes in awk a little better. Thanks way in advance
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'