be quiet unless verbose
[rrq/rrqforth.git] / grepline.sh
1 #!/bin/bash
2 #
3 # This script implements some special commands that are set up for gdb
4 # in debug.sh
5
6 F=${1-rrqforth.map}
7
8 #echo "$*"
9
10 case "$3" in
11     1)
12         if [ -n "$4" ] ;then
13             if [ -z "${4%%-*}" ] ; then
14                 N=( -B "${4#-}" )
15             else
16                 N=( -A ${4} )
17             fi
18         fi
19         grep "${N[@]}" -E "$2" $F
20         ;;
21     *)
22         grep -E "(\\bWORD\\b|^$2) " $F | \
23             awk '$3 == "WORD" {x=$0;next} x!="" {print x; x=""}{ print;}'
24 esac