Idx − make and manipulate index files.


@BINDIR@/idx [−dhmprtw] file


Idx is an helper tool to make and to manipulate index files. Idx has been made to automatically index troff document, but it can also be used manually, to make an index of a book.



There’s four format of index file that Idx can work with: a list of pages, a list of words, troff output and troff input.

List of pages

A list of pages indicates which words appears on a page. Each line of a list of pages is formatted as follow:


33:: troff, refer, index
34:: troff, index, nroff
35:: index, unix, refer

List of words

A list of words indicates in which pages appears a word. Each line of a list of words is formatted as follow:

The previous example would be formatted as follow:

index:: 33−35
nroff:: 34
refer:: 33, 35
troff:: 33
unix:: 35

Troff output

When idx is used to index a troff document, the output produced by troff and passed to idx should be as follow:

The previous example should be formatted as follow:

W> troff:: 33
W> refer:: 33
W> index:: 33
W> troff:: 34
W> index:: 33
W> nroff:: 34
W> index:: 35
W> unix:: 35
W> refer:: 35

Troff input

Idx can format an index so that troff can print it correctly. The format of troff input is as follow:

.K<                  \" one letter keyword defining the index
.ds <P x, m−n    \" list of pages
.K> word             \" the word which appears on these pages

So, a troff macro that use idx should define the following macros:


This example taken from real life will show how to print an index of a paper book.

idx −w a.idx > b.idx
idx −r b.idx > c.idx
idx −t c.idx | troff | dpost >


Idx is needed by utmac(7) to build indexes. In that case, if heirloom troff is used, and if heirloom tools are in the begining of the path, be sure that ’awk’ links to heirloom ’nawk’ and not heirloom ’oawk’.






Idx and this man page are distributed under the ics license


Written by Pierre-Jean Fichet.