Skip to content

Instantly share code, notes, and snippets.

@ericzumba
Last active September 14, 2015 22:11
Show Gist options
  • Save ericzumba/0a2a1ee5532f7fc51049 to your computer and use it in GitHub Desktop.
Save ericzumba/0a2a1ee5532f7fc51049 to your computer and use it in GitHub Desktop.
count log lines per second
cat log/chupacabra.log | grep -o -E "[0-9]{2}:[0-9]{2}:[0-9]{2}" | uniq -c
# matches the whole date at the begining of the line
tail -n 100 log/chupacabra.log | grep -o -E "^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}" | uniq -c
@ericzumba
Copy link
Author

To grab only the counts
cat counts_and_times_file | grep -o -E "^\s*(\d*)\s{1}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment