Ravi Sir's Cards › AWS
awk reports
This revision card explains awk reports. It starts from the need that totals and counts in one line. It describes arrays group by a key. The how-to section notes END prints the results. An example on the card is hits per IP.
Read card text
What this card says
Why do we need it?
Totals and counts in one line.
What is it?
Arrays group by a key.
How to do it
END prints the results.
Example
Hits per IP.
awk '{c[$1]++} END {for(i in c) print i, c[i]}' access.log