Last active
May 13, 2022 23:18
-
-
Save luty81/f6e5603ab7757027f3db9017cd0cd2cd to your computer and use it in GitHub Desktop.
AWK Awesome
This file contains 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
{ | |
date = $1 | |
hour = substr($2,1,2) | |
group[date, hour]++ | |
}END{ | |
print "Date" "\t\t" "Hour" "\t" "Total" | |
print "====" "\t\t" "====" "\t" "======" | |
for (item in group) print substr(item, 1, 10) "\t" substr(item, 11, 3) "\t", group[item] | |
} |
This file contains 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
BEGIN { | |
print "Metric" "\t\t" "Avg" "\t\t" "Max" "\t\t" "SD +/-"; | |
print "======" "\t\t" "===" "\t\t" "===" "\t\t" "======"; | |
} | |
{ | |
if (NR > 3 && NR < 6) { | |
print $2 " " $3 " " $5 "\t\t" $6; | |
} | |
else if (NR == 6) { | |
print ""; | |
print $2; | |
} | |
else if (NR > 6) { | |
print $0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment