LinuxCommandLibrary

ptx

Produce permuted keyword-in-context index

TLDR

Generate index with line references

$ ptx -r [file]
copy
Generate with auto references
$ ptx -A [file]
copy
Set output width
$ ptx -w [80] [file]
copy
Use word filter
$ ptx -o [filter_file] [file]
copy
Use SYSV traditional mode
$ ptx -G [file]
copy

SYNOPSIS

ptx [-A] [-r] [-w width] [-o file] [-G] [inputfile_]

DESCRIPTION

ptx produces a permuted index (also known as KWIC - Key Word In Context) from text files. Each significant word appears as an index entry with surrounding context, allowing readers to locate topics by any word.
The output shows each word centered with its surrounding context, useful for creating concordances or keyword indexes for documentation.

PARAMETERS

-A, --auto-reference

Generate automatic index references
-r, --references
Use first field as index reference
-w, --width _cols_
Output line width in columns
-o, --only-file _file_
Read list of words to index
-i, --ignore-file _file_
Read list of words to ignore
-G, --traditional
SYSV-compatible behavior

CAVEATS

Output format designed for old terminals. May need post-processing for modern use. Word filtering requires separate file. Large files produce extensive output.

HISTORY

ptx is a traditional Unix text processing tool, part of GNU coreutils. Permuted indexes were important for printed documentation before full-text search became common.

SEE ALSO

sort(1), grep(1), awk(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community