home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / man / man1 / sort.1 < prev    next >
Encoding:
Text File  |  1975-06-26  |  3.0 KB  |  144 lines

  1. .th "SORT" I 5/13/75
  2. .sh NAME
  3. sort, usort \*- sort or merge files
  4. .sh SYNOPSIS
  5. .bd sort
  6. [
  7. .if t \fB\*-abdnrt\fIx\fR
  8. .if n -abdnrt______x
  9. ]
  10. [ \fB+\fIpos \fR [ \fB\*-\fIpos \fR]
  11. ] . . .
  12. .bd \*-mo 
  13. ]
  14. [ name ] . . .
  15. .br
  16. .bd usort
  17. [
  18. .bd \-umo
  19. ] [ name ] . . .
  20. .sh DESCRIPTION
  21. .it Sort
  22. sorts
  23. all the named files together
  24. and writes the result on
  25. the standard output.
  26. The name `\*-' means
  27. the standard input.
  28. The standard input is also used if no input file names are given.
  29. Thus
  30. .it sort
  31. may be used as a filter.
  32. .s3
  33. The default sort key is an entire line.
  34. Default ordering is lexicographic in ASCII collating sequence,
  35. except that lower-case letters are considered
  36. the same as the corresponding upper-case letters.
  37. Non-ASCII bytes are ignored.
  38. The ordering is affected by the flags
  39. .if t \fB\*-abdnrt\fR,
  40. .if n .it abdnrt,
  41. one or more of which may appear:
  42. .s3
  43. .lp +4 4
  44. \fBa\fR    Do not map lower case letters.
  45. .s3
  46. .lp +4 4
  47. \fBb\fR    Leading blanks (spaces and tabs) are not included in fields.
  48. .s3
  49. .lp+4 4
  50. \fBd\fR    `Dictionary' order: only letters, digits and blanks
  51. are significant in ASCII comparisons.
  52. .s3
  53. .lp +4 4
  54. \fBn\fR    An initial numeric string,
  55. consisting of optional minus sign,
  56. digits and optionally included decimal point,
  57. is sorted by arithmetic value.
  58. .s3
  59. .lp+4 4
  60. \fBr\fR    Reverse the sense of comparisons.
  61. .s3
  62. .lp +4 4
  63. \fBt\fIx\fR    Tab character between fields is
  64. .it x.
  65. .s3
  66. .i0
  67. Selected parts of the line, specified by
  68. \fB+\fIpos\fR
  69. and
  70. \fB\*-\fIpos\fR,
  71. may be used as sort keys.
  72. .it Pos 
  73. has the form
  74. .it m.n,
  75. where
  76. .it m
  77. specifies a number of fields to skip,
  78. and 
  79. .it n
  80. a number of characters to skip further into the next field.
  81. A missing
  82. .it \\.n
  83. is taken to be 0.
  84. \fB+\fIpos\fR denotes the beginning of the key;
  85. \fB\*-\fIpos\fR denotes the first position after the key
  86. (end of line by default).
  87. The ordering rule may be overridden for a particular key
  88. by appending one or more of the flags
  89. .bd abdnr
  90. to
  91. \fB+\fIpos\fR.
  92. .s3
  93. When no tab character has been specified,
  94. a field consists of
  95. nonblanks and any preceding blanks.
  96. Under the
  97. .bd \*-b
  98. flag, leading blanks are excluded from a field.
  99. When a tab character has been specified,
  100. a field is a
  101. string ending with a tab character.
  102. .s3
  103. .i0
  104. When keys are specified,
  105. later keys are compared only when all earlier ones compare equal.
  106. Lines that compare equal are ordered
  107. with all bytes significant.
  108. .s3
  109. These flag arguments are also understood:
  110. .s3
  111. .lp +4 4
  112. \fB\*-m\fR    Merge only, the input files are already sorted.
  113. .s3
  114. .lp +4 4
  115. \fB\*-o\fR    The next argument is the name of an output file
  116. to use instead of the standard output.
  117. This file may be the same as one of the inputs,
  118. except under the merge flag \fB\*-m\fR.
  119. .i0
  120. .s3
  121. .it Usort
  122. is a somewhat specialized version of
  123. .it sort
  124. which accepts no collating sequence options:
  125. order is always
  126. plain ASCII.
  127. It also strips out the second and following copies
  128. of duplicated lines.
  129. A
  130. .it u
  131. flag prevents this stripping.
  132. .it Usort
  133. also understands
  134. the
  135. .it m
  136. and
  137. .it o
  138. options in the same way as
  139. .it sort.
  140. .sh FILES
  141. /usr/tmp/stm???
  142. .sh BUGS
  143.