X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=grepline.sh;h=bb453da0ceeea9f0be80cb0237524581d22bf3e9;hb=d7958ae7b474ef357864237fc40412139e43b117;hp=677484a61f443ccda6a073867fa07ba73397c3aa;hpb=3f5ae14cc91f1a3fe6a4c39bd4efc6f5f93220c5;p=rrq%2Frrqforth.git diff --git a/grepline.sh b/grepline.sh index 677484a..bb453da 100755 --- a/grepline.sh +++ b/grepline.sh @@ -1,3 +1,24 @@ #!/bin/bash # -grep "^$1 " rrqforth.map +# This script implements some special commands that are set up for gdb +# in debug.sh + +F=${1-rrqforth.map} + +#echo "$*" + +case "$3" in + 1) + if [ -n "$4" ] ;then + if [ -z "${4%%-*}" ] ; then + N=( -B "${4#-}" ) + else + N=( -A ${4} ) + fi + fi + grep "${N[@]}" -E "$2" $F + ;; + *) + grep -E "(\\bWORD\\b|^$2) " $F | \ + awk '$3 == "WORD" {x=$0;next} x!="" {print x; x=""}{ print;}' +esac