Making an index from a nroff file - how?

Tim Kuehn timk at egvideo.UUCP
Tue Feb 14 15:00:00 AEST 1989


I have a application where the user has generated a set of chapters to 
go togehter in a book using nroff. This being a very mathematically-
oriented book, it also has tons of equations(hence must be run through eqn)
and tables with the corresponding commands those processors use. 

The problem is this. The typesetting has been done, the pages all look 
nice and neat from the laser printer - and the client has decided he 
wants an index! Had this been known at the outset the appropriate commands
could have been inserted into the source files, but now it's too late and
we have to backtrack. There are almost 500 words/phrases/proper names
that have to be indexed out of 11 chapters, a preface, and introduction.
A non-trivial task indeed! 

So far as I can tell (not being the principle worker on this project, I 
was called in to see what I could do) it's a matter of finding the references
in file "A" (which has all the words to be indexed) which occur in the 
respective files for the chapters and replacing them with an command 
sequence along with the original word. Thus a line that looks like this
(assuming one was indexing on the word "Tim"):

Did Tim walk to the park?

would be changed to:

Did /c
.ix Kuehn, Timothy D.
Tim Walk to the park?

Is there a sed/awk script or other program that will do this kind of indexing
for me? The system is an AT&T running their latest version of unix. Needless
to say if there's a way around having to manually doing these insertions I'd 
like do that!

Many thanks for any and all help.

+-----------------------------------------------------------------------------+
|Timothy D. Kuehn					timk at egvideo          |
|TDK Consulting Services			        !watmath!egvideo!timk |
|871 Victoria St. North, Suite 217A					      |
|Kitchener, Ontario, Canada N2B 3S4 		        (519)-741-3623 	      |
+-----------------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list