Skip to content

Instantly share code, notes, and snippets.

@shcallaway
Created October 1, 2019 20:32
Show Gist options
  • Save shcallaway/5a0feee0f834e3141a0a2bffe8286191 to your computer and use it in GitHub Desktop.
Save shcallaway/5a0feee0f834e3141a0a2bffe8286191 to your computer and use it in GitHub Desktop.
Count the number of log lines that contain a field "trace_id"
#!/bin/bash
TOTAL=$(cat $1 | wc -l)
TOTAL_W_TRACE_ID=$(cat input.csv | awk 'BEGIN { FS = "," } ; { print $5 }' | grep . | wc -l)
echo "Total: $TOTAL"
echo "Total with trace_id: $TOTAL_W_TRACE_ID"
echo "To calculate a percentage, plug these numbers into something that can do floating point arithmetic."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment