Created
February 14, 2020 03:36
-
-
Save NanXiao/a4dab0913ece1333895d3ab2e0b53a0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
BEGIN { | |
FS = ","; | |
} | |
function update_array(server_name, ticket, full_array, partial_bytes_array) | |
{ | |
if (length(ticket) != 0) | |
{ | |
partial_bytes_array[server_name, substr(ticket, 1, 16)]++; | |
full_array[ticket]++; | |
} | |
} | |
function array_elem_num(array) | |
{ | |
elems_num = 0; | |
for (ticket in array) | |
{ | |
if (array[ticket] > 1) | |
{ | |
elems_num++; | |
} | |
} | |
return elems_num; | |
} | |
{ | |
update_array($5, $3, session_ticket_full_array, session_ticket_partial_bytes_array); | |
update_array($5, $4, session_ticket_full_array, session_ticket_partial_bytes_array); | |
} | |
END { | |
printf "Array element number (use full ticket as key): %d\n", array_elem_num(session_ticket_full_array); | |
printf "Array element number (use sever name and first 8 bytes of ticket as key): %d\n", array_elem_num(session_ticket_partial_bytes_array); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment