Hi! Can someone explain the following:
I'm a bit confused...
Code:
/tmp # uname -sr
HP-UX B.11.31
/tmp # cat testf
1,1,1,1,NODE,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,2,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,3,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,4,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,5,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,6,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,7,1,1,1,1,1,1,1,1,1
1,1,1,1,NODE,1,8,1,1,1,1,1,1,1,1,1
/tmp # awk -F"," '{clients[$5]+=$7}
END { for (client in clients)
printf "%s\t-\t\t%d" client, clients[client] }' testf
awk: There are not enough parameters in printf statement %s - %dNODE.
The input line number is 8. The file is testf.
The source line number is 3.
/tmp # awk -F"," '{clients[$5]+=$7}
END { for (client in clients)
print client,"-", clients[client] }' testf
NODE - 36
I'm a bit confused...