📄 lsort.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) lsort.n 1.10 97/08/22 18:50:53'\" .so man.macros.TH lsort n 8.0 Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMElsort \- Sort the elements of a list.SH SYNOPSIS\fBlsort \fR?\fIoptions\fR? \fIlist\fR.BE.SH DESCRIPTION.PPThis command sorts the elements of \fIlist\fR, returning a newlist in sorted order. By default ASCII sorting is used withthe result returned in increasing order.However, any of thefollowing options may be specified before \fIlist\fR tocontrol the sorting process (unique abbreviations are accepted):.TP 20\fB\-ascii\fRUse string comparison with ASCII collation order. This isthe default..VS 8.0 br.TP 20\fB\-dictionary\fRUse dictionary-style comparison. This is the same as \fB\-ascii\fRexcept (a) case is ignored except as a tie-breaker and (b) if twostrings contain embedded numbers, the numbers compare as integers,not characters. For example, in \fB\-dictionary\fR mode, \fBbigBoy\fRsorts between \fBbigbang\fR and \fBbigboy\fR, and \fBx10y\fRsorts between \fBx9y\fR and \fBx11y\fR..VE.TP 20\fB\-integer\fRConvert list elements to integers and use integer comparison..TP 20\fB\-real\fRConvert list elements to floating-point values and use floatingcomparison..TP 20\fB\-command\0\fIcommand\fRUse \fIcommand\fR as a comparison command.To compare two elements, evaluate a Tcl script consisting of\fIcommand\fR with the two elements appended as additionalarguments. The script should return an integer less than,equal to, or greater than zero if the first element is tobe considered less than, equal to, or greater than the second,respectively..TP 20\fB\-increasing\fRSort the list in increasing order (``smallest'' items first).This is the default..TP 20\fB\-decreasing\fRSort the list in decreasing order (``largest'' items first)..VS 8.0 br.TP 20\fB\-index\0\fIindex\fRIf this option is specified, each of the elements of \fIlist\fR mustitself be a proper Tcl sublist. Instead of sorting based on whole sublists,\fBlsort\fR will extract the \fIindex\fR'th element from each sublistand sort based on the given element. The keyword \fBend\fP is allowedfor the \fIindex\fP to sort on the last sublist element. For example,.RS.CSlsort -integer -index 1 {{First 24} {Second 18} {Third 30}}.CEreturns \fB{Second 18} {First 24} {Third 30}\fR.This option is much more efficient than using \fB\-command\fRto achieve the same effect..RE.VE.SH KEYWORDSelement, list, order, sort
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -