#!/bin/sh
#
# The tags should be generated with "ctags -n" (for line numbers).
# Invoke with "find-tag.sh /absolute/path/to/tags symbol"

tags=$1
symbol=$2

base_dir=${tags%/*}

for line in $(grep -e "^$symbol	" $tags \
		| sed -e "s/^[^	]\+	\([^	]\+\)	\([0-9]\+\);\".*$/\1:\2/g")
do
	file=${line%:*}
	l_no=${line##*:}

	geany -l $l_no $base_dir/$file
done