Skip to content

Instantly share code, notes, and snippets.

@juven
Created June 24, 2013 09:00
Show Gist options
  • Save juven/5848707 to your computer and use it in GitHub Desktop.
Save juven/5848707 to your computer and use it in GitHub Desktop.
BEGIN {
FS = ","
bytes_created = 0
bytes_wrote = 0
bytes_deleted = 0
}
$4 == "createFile" {
bytes_field_length = length($10)
bytes_created += substr($10, 3, bytes_field_length-3)
printf("create %s\n", substr($10, 3, bytes_field_length-3))
}
$4 == "delete" {
bytes_field_length = length($7)
bytes_deleted += substr($7, 3, bytes_field_length-3)
printf("delete %s\n", substr($7, 3, bytes_field_length-3))
}
$4 == "writeFile" {
bytes_field_length = length($9)
bytes_wrote += substr($9, 3, bytes_field_length-3)
printf("write %s\n", substr($9, 3, bytes_field_length-3))
}
END {
printf("Total (create + write - delete): %s \n" , bytes_created + bytes_wrote - bytes_deleted)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment