ptx

ptx produces a permuted index — a concordance. For each significant word in the input, it prints a line showing that word together with the text around it, so the same passage appears once per keyword it contains.

ptx [options] [input...]
$ ptx manual.txt

A permuted index is the kind of index found at the back of a reference book: every keyword, in alphabetical order, each shown in its context. ptx builds one from plain text. With no file, it reads standard input.

Choosing the keywords #

OptionEffect
-W, --word-regexp=REGEXPTreat anything matching REGEXP as a keyword.
-b, --break-file=FILETake the set of word-break characters from FILE.
-i, --ignore-file=FILERead a list of words to exclude from FILE.
-o, --only-file=FILEIndex only the words listed in FILE.
-f, --ignore-caseFold case together when sorting.

Output format #

OptionEffect
-w, --width=NSet the output width, in columns.
-g, --gap-size=NSet the gap, in columns, between the output fields.
-A, --auto-referenceGenerate a reference (file name and line number) for each entry automatically.
-r, --referencesTreat the first field of each input line as a reference for that line.
-R, --right-side-refsPut references on the right, and exclude them from the width count.
-F, --flag-truncation=STRINGUse STRING to mark where a line was truncated.
-O, --format=roffEmit the index as roff typesetting directives.
-T, --format=texEmit the index as TeX typesetting directives.
-M, --macro-name=NAMEUse NAME as the macro name in roff/TeX output.
-G, --traditionalBehave like the older System V ptx, without the extended features.

Exit status #

CodeMeaning
0Success.
1A file could not be read, or an option value was invalid.

Edit this page