Skip to content

Instantly share code, notes, and snippets.

@bentito
Created November 7, 2019 17:24
Show Gist options
  • Save bentito/bbb0f9eb08a3a53a94f01707d4c71d0d to your computer and use it in GitHub Desktop.
Save bentito/bbb0f9eb08a3a53a94f01707d4c71d0d to your computer and use it in GitHub Desktop.
#!/bin/bash
# usage cmd_name <search_term> [<number of chars before & after for context>]
# NOTE: wired to metering-operator specifically
search_term=$1
context_amt=${2:-50}
echo "search term: $search_term"
echo "context of chars before & after: $context_amt"
docker exec -i metering-operator bash -c 'tail -n +1 -f /tmp/ansible-operator/runner/metering.openshift.io/v1/MeteringConfig/*/*/artifacts/*/stdout' | grep --line-buffered --only-matching --extended-regexp ".{0,${context_amt}}${search_term}.{0,${context_amt}}"|grep --line-buffered --color --extended-regexp "${search_term}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment