Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sum_bytes() {
- declare -A sum;
- while read data;
- do
- ip=$(echo $data | awk '{print $1}');
- bytes=$(echo $data | awk '{print $2}');
- if [[ ! ${sum["$ip"]} ]]; then sum[$ip]="0"; fi
- sum["$ip"]=$(expr "${sum["$ip"]}" + $bytes);
- done
- for i in "${!sum[@]}"
- do
- echo -e "$i\t${sum[$i]}";
- done
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement