But since I never really need it - as in "I couldn't have done this/my job without it", I seldom use it, and tend to forget the most useful invocations I find.
So... here's a useful one-liner I'm sure I'll need to look up again sometime.
myhost $ awk '{op[$6]++} END {for (o in op) print o, op[o] }' access.log
access.log
here is a server-side file logging each invocation of some web service methods. (not that you should care :) The file has a rigid structure: One line per invocation containing method name, caller, timestamp.op[$6]++
Constructs a hash table namedop
with method names as keys and numbers of invocations as values. (Default field separator is whitespace.)- When the file has been processed, the results are printed out
myhost $ awk '{$1 > "2009-10-31" && op[$6]++} END {for (o in op) print o, op[o] }' access.log
No comments:
Post a Comment