Skip to content

Commit ccc7b5d

Browse files
committed
data aggregation example 2
1 parent 11e8146 commit ccc7b5d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

aggregation2.awk

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Data aggregation 2
2+
# Compute how many bytes per IP are processed.
3+
# Example: awk klashxx$ awk -f aggregation2.awk files/ips.dat
4+
#
5+
6+
NR==1{
7+
next
8+
}
9+
10+
lip && lip != $1{
11+
print lip,sum
12+
sum=0
13+
}
14+
{
15+
sum+=$2
16+
lip=$1
17+
}
18+
19+
END{
20+
print lip,sum
21+
}

0 commit comments

Comments
 (0)