SORT
Section: FSF (1)
Updated: 1999年12月
NAME(名称)
SYNOPSIS(总览)
../src/sort [OPTION]... [FILE]...
DESCRIPTION(描述)
将排序好的所有文件串写到标准输出上。
- +POS1 [-POS2]
- 从关键字POS1开始,到POS2*之前*结束(快过时了) 字段数和字符偏移量都从零开始计数(与-k选项比较)
- -b
- 忽略排序字段或关键字中开头的空格
- -c
- 检查是否指定文件已经排序好了,不排序.
- -d
- 在关键字中只考虑[a-zA-Z0-9]字符.
- -f
- 将关键字中的小写字母折合成大写字母.
- -g
- 按照通常的数字值顺序作比较,暗含-b
- -i
- 在关键字中只考虑[\040-\0176]字符.
- -k POS1[,POS2]
- 从关键字POS1开始,*到*POS2结束. 字段数和字符偏移量都从1开始计数(与基于零的+POS格式作比较)
- -l
- 按照当前环境排序.
- -m
- 合并已经排序好的文件,不排序.
- -M
- 按(未知的)<`JAN'<...<`DEC'的顺序比较,暗含-b
- -n
- 按照字符串的数值顺序比较,暗含-b
- -o FILE
- 将结果写入FILE而不是标准输出.
- -r
- 颠倒比较的结果.
- -s
- 通过屏蔽最后的再分类比较来稳定排序.
- -t SEP
- 使用SEP来替代空格的转换non-.
- -T DIRECTORY
- 使用DIRECTORY作为临时文件,而不是$TMPDIR或者/tmp
- -u
- 如果有-c,则按严格的顺序进行检查; 如果有-m,则只输出相等顺序的第一个.
- -z
- 以0字节结束行,而不是使用换行符,这是为了找到-print0
- --help
- 显示帮助并退出.
- --version
- 输出版本信息并退出.
POS为F[.C][OPTS],这里的F指的是字段数,而C为字段中的字符位置,这在-k中是从开 始计数的,而在过时的格式中是从零开始的.OPTS可由一个或多个Mbdfinr组成;这有效地屏蔽了 对于那个关键字的全局-Mbdfinr设置.如果没有指定关键字,则使用整行作为关键字.如 果没有FILE,或者FILE是-,则从标准输入读取.
AUTHOR(作者)
REPORTING BUGS(报告BUGS)
报告bugs,请发到<bug-textutils@gnu.org>.
COPYRIGHT(版权)
版权所有?1999 Free Software Foundation, Inc.
这是自由软件;参见关于复制条件的源文件.不承担任何责任;更不用说商用性或特殊需求的适 应性.
SEE ALSO (另见)
sort 的完整文档是以Texinfo手册的方式维护的.如果在你那儿正确地安装了 info 和 sort程序,命令
- info sort
应该可以让你访问整个手册.
[中文版维护人]
riser E-mail:boomer@ccidnet.com
[中文版最新更新]
2000/12/5
(http://www.fanqiang.com)
#p#
NAME
sort - sort lines of text files
SYNOPSIS
DESCRIPTION
Write sorted concatenation of all FILE(s) to standard output.
Ordering options:
Mandatory arguments to long options are mandatory for short options too.
- -b, --ignore-leading-blanks ignore leading blanks
- -d, --dictionary-order
- consider only blanks and alphanumeric characters
- -f, --ignore-case
- fold lower case to upper case characters
- -g, --general-numeric-sort
- compare according to general numerical value
- -i, --ignore-nonprinting
- consider only printable characters
- -M, --month-sort
- compare (unknown) < `JAN' < ... < `DEC'
- -n, --numeric-sort
- compare according to string numerical value
- -r, --reverse
- reverse the result of comparisons
Other options:
- -c, --check
- check whether input is sorted; do not sort
- -k, --key=POS1[,POS2]
- start a key at POS1, end it at POS 2 (origin 1)
- -m, --merge
- merge already sorted files; do not sort
- -o, --output=FILE
- write result to FILE instead of standard output
- -s, --stable
- stabilize sort by disabling last-resort comparison
- -S, --buffer-size=SIZE
- use SIZE for main memory buffer
- -t, --field-separator=SEP use SEP instead of non-blank to blank transition
- -T, --temporary-directory=DIR
- use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories
- -u, --unique
- with -c, check for strict ordering; without -c, output only the first of an equal run
- -z, --zero-terminated
- end lines with 0 byte, not newline
- --help
- display this help and exit
- --version
- output version information and exit
POS is F[.C][OPTS], where F is the field number and C the character position in the field. OPTS is one or more single-letter ordering options, which override global ordering options for that key. If no key is given, use the entire line as the key.
SIZE may be followed by the following multiplicative suffixes: % 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.
With no FILE, or when FILE is -, read standard input.
*** WARNING *** The locale specified by the environment affects sort order. Set LC_ALL=C to get the traditional sort order that uses native byte values.
AUTHOR
Written by Mike Haertel and Paul Eggert.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright © 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO
The full documentation for sort is maintained as a Texinfo manual. If the info and sort programs are properly installed at your site, the command
- info coreutils sort
should give you access to the complete manual.