#!/bin/sh # # usage: mxref-tags infile1 infile2 ... >outfile # # create index lines for all tokens in the given files, # using GNU ctags -x to call out defining instances # # When displaying in vxref, the defining instances will have # the filename indented, which means they will sort to the top # of the list of instances of the name. ( ctags -x ${1+"$@"} | nawk '{printf( "%s %s %4d\n", $1, $3, $2)}' nawk '{ sub("$"," ") gsub("[^a-zA-Z0-9_]+"," ") sub("^ ","") gsub(" "," " FILENAME " " sprintf("%4d",FNR) "\n") printf "%s",$0 }' ${1+"$@"} ) | egrep '.....* .* ' | sort -T .