You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
403 B

#!/usr/bin/env bash
after=0
before=0
search=''
if [ $# == 0 ]; then
echo "Usage: $0 [-A <after>] [-B <before>] query"
exit 1
fi
while [ $# != 0 ]; do
case "$1" in
-A)
after="$2"
shift
shift
;;
-B)
before="$2"
shift
shift
;;
*)
search="$search $1"
shift
;;
esac
done
grep -r -i -n --color="always" --include=\*.{html,htm} -A "$after" -B "$before" "$search" .