set -euo pipefail
export LC_ALL=C
grep_work=$(mktemp -d "${TMPDIR:-/tmp}/grep-example.XXXXXX")
trap 'rm -rf -- "$grep_work"' EXIT
cd "$grep_work"
mkdir -p data
cat > data/context.txt <<'GRP_INPUT_1'
one
two
HIT first
four
five
six
HIT last
eight
nine
GRP_INPUT_1

grep_gnu_binary=$(command -v ggrep || command -v grep)
grep_gnu_version=$("$grep_gnu_binary" --version 2>/dev/null || :)
case "$grep_gnu_version" in
  *"GNU grep"*) ;;
  *) printf 'This example requires GNU grep.\n' >&2; exit 69 ;;
esac
ggrep() { "$grep_gnu_binary" "$@"; }

ggrep -C 1 --no-group-separator 'HIT' data/context.txt
