Home > computers > linux > awk > awksum| About

awk '{sum+=$3} END {print sum}' will sum on the third column and print the sum at the END.

Example with find :

$ find /var/vmail/mydomain.tld/m.stefan -mtime -7 -type f -not -name '*dovecot*' -printf %s\n | awk '{sum+=$1} END {print (sum / 1024)}'

This prints the size of the mail (in Kilobytes) received by user m.stefan in the last 7 days, which is 234M in this example.

contact : @ychaouche yacinechaouche at yahoocom

QR Code
QR Code awksum (generated for current page)