#!/bin/sh # # htags: generate tags file from HTML NAME-tags # # tags::tagnamefilenamesearch # # Note, that search pattern cannot contain [.*] # (makes vi claim, tag is `out of date') # and, that the sort order is significant. # #echo "$*" | grep '/' >/dev/null || dir="`pwd | sed -e 's,/,\\\/,g'`\\/" if [ $# -eq 1 ] ;then file="$1" grep -n "<[Aa] NAME=.*" $* | \ sed -ne 's/^\([^:]*\):.* NAME="\([^ "]*\).*/\2 '$dir$file' \/NAME=\"\2\"\//p' | sort # awk -F: " # {print \$2\" $file \"\$1 } # " else grep -n "<[Aa] NAME=.*" $* | \ sed -ne 's/^\([^:]*\):\([^:]*\):.* NAME="\([^ "]*\).*/\3 \1 \/NAME=\"\3\"\//p' | sort fi