#Bash 的 ptx 命令
ptx [OPTION]... [FILE]...
功能
生成文件内容的关键词排列索引。
类型
可执行文件(/usr/bin/ptx),属于 coreutils。
参数
OPTION选项:-A,--auto-reference- 输出自动生成引用-G,--traditional- 使用传统(System V)模式-F,--flag-truncation=STRING- 使用STRING作为行的截断标记;默认为'/'-M,--macro-name=STRING- 使用STRING作为宏名称;默认为xx-O,--format=roff- 以 roff 命令的格式生成输出-R,--right-side-refs- 将引用放置在右侧-S,--sentence-regexp=REGEXP- 使用正则表达式REGEXP作为行或句子的结束标记-T,--format=tex- 以 TeX 命令的格式生成输出-W,--word-regexp=REGEXP- 使用正则表达式REGEXP匹配关键词-b,--break-file=FILE- 以FILE文件中的字符作用单词分隔符-f,--ignore-case- 排序时忽略大小写(转换为大写进行排序)-g,--gap-size=NUMBER- 输出字段之间的间隙大写为NUMBER-i,--ignore-file=FILE- 以FILE文件中的单词作为忽略词列表-o,--only-file=FILE- 以FILE文件中的单词作为只读单词列表-r,--references- 每行的第一个字段是引用-t,--typeset-mode-此选项为实现-w,--width=NUMBER- 输出宽度为NUMBER(不含引用)--help- 显示帮助--version- 显示版本
FILE- 文件列表,如果没有这个参数或指定为-,则读取标准输入
#示例
$ man ptx > 1.txt # 创建文件
$ ptx -W ptx -A -R 1.txt # 创建关键词 ptx 的索引 生成引用 引用显示在右侧
file contents/ /PTX(1) NAME ptx - produce a permuted index of 1.txt:4
/dex of file contents SYNOPSIS ptx [OPTION]... [INPUT]... 1.txt:7
] DESCRIPTION/ (without -G) ptx -G [OPTION]... [INPUT [OUTPUT] 1.txt:8
/behave more like System V ' ptx' -F, --flag-truncation/ 1.txt:23
/www.gnu.org/software/coreutils/ ptx> or available locally v/ 1.txt:88
/locally via: info '(coreutils) ptx invocation' GNU coreutils 9.4/ 1.txt:89
#推荐阅读
#手册
PTX(1) User Commands PTX(1) NAME ptx - produce a permuted index of file contents SYNOPSIS ptx [OPTION]... [INPUT]... (without -G) ptx -G [OPTION]... [INPUT [OUTPUT]] DESCRIPTION Output a permuted index, including context, of the words in the input files. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -A`, --auto-reference` output automatically generated references -G, --traditional behave more like System V 'ptx' -F, --flag-truncation=STRING use STRING for flagging line truncations. The default is '/' -M, --macro-name=STRING macro name to use instead of 'xx' -O, --format=roff generate output as roff directives -R, --right-side-refs put references at right, not counted in -w -S, --sentence-regexp=REGEXP for end of lines or end of sentences -T, --format=tex generate output as TeX directives -W, --word-regexp=REGEXP use REGEXP to match each keyword -b, --break-file=FILE word break characters in this FILE -f, --ignore-case fold lower case to upper case for sorting -g, --gap-size=NUMBER gap size in columns between output fields -i, --ignore-file=FILE read ignore word list from FILE -o, --only-file=FILE read only word list from this FILE -r, --references first field of each line is a reference -t, --typeset-mode - not implemented - -w, --width=NUMBER output width in columns, reference excluded --help display this help and exit --version output version information and exit AUTHOR Written by F. Pinard. REPORTING BUGS GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Report any translation bugs to <https://translationproject.org/team/> COPYRIGHT Copyright © 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO Full documentation <https://www.gnu.org/software/coreutils/ptx> or available locally via: info '(coreutils) ptx invocation' GNU coreutils 9.4 April 2024 PTX(1)