Skip to content

Commit 20407ae

Browse files
committed
sort(1): try to fix up markup
Hopefully should make the part about -k vs -/+ a bit easier to read.
1 parent 971a1f8 commit 20407ae

1 file changed

Lines changed: 74 additions & 53 deletions

File tree

usr.bin/sort/sort.1

Lines changed: 74 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" $NetBSD: sort.1,v 1.44 2026/01/17 19:29:44 uwe Exp $
1+
.\" $NetBSD: sort.1,v 1.45 2026/01/17 20:40:59 uwe Exp $
22
.\"
33
.\" Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
44
.\" All rights reserved.
@@ -70,7 +70,7 @@
7070
.Op Fl bdfHilmnrSsu
7171
.Oo
7272
.Fl k
73-
.Ar kstart Ns Op Li \&, Ns Ar kend
73+
.Ar kstart Ns Op Cm \&, Ns Ar kend
7474
.Oc
7575
.Op Fl o Ar output
7676
.Op Fl R Ar char
@@ -82,11 +82,11 @@
8282
.Op Fl bdfilnru
8383
.Oo
8484
.Fl k
85-
.Ar kstart Ns Op Li \&, Ns Ar kend
85+
.Ar kstart Ns Op Cm \&, Ns Ar kend
8686
.Op Fl t Ar char
8787
.Oc
8888
.Op Fl R Ar char
89-
.Op Ar file
89+
.Op Ar
9090
.Sh DESCRIPTION
9191
The
9292
.Nm
@@ -179,17 +179,20 @@ Ignore all non-printable characters.
179179
Sort by the string length of the field, not by the field itself.
180180
.It Fl n
181181
An initial numeric string, consisting of optional blank space, optional
182-
plus or minus sign, and zero or more digits (including decimal point)
182+
plus or minus sign, and zero or more digits
183+
.Pq including decimal point
183184
.\" with
184185
.\" optional radix character and thousands
185186
.\" separator
186187
.\" (as defined in the current locale),
187188
is sorted by arithmetic value.
188-
(The
189+
.Po
190+
The
189191
.Fl n
190192
option no longer implies the
191193
.Fl b
192-
option.)
194+
option
195+
.Pc .
193196
.It Fl r
194197
Reverse the sense of comparisons.
195198
.El
@@ -208,15 +211,13 @@ option applies globally to all
208211
options.
209212
Otherwise, the
210213
.Fl b
211-
option can be attached independently to each
212-
.Ar field
213-
argument of the
214+
option can be attached independently to each field argument of the
214215
.Fl k
215216
option (see below).
216217
Note that the
217218
.Fl b
218219
option has no effect unless key fields are specified.
219-
.It Fl k Ar kstart Ns Op Li \&, Ns Ar kend
220+
.It Fl k Ar kstart Ns Op Cm \&, Ns Ar kend
220221
Designates the starting position,
221222
.Ar kstart ,
222223
and optional ending position,
@@ -237,11 +238,20 @@ usually produces undesirable results.
237238
If char is not a single character, then it
238239
specifies the value of the desired record
239240
separator as an integer specified in any
240-
of the normal NNN, 0ooo, or 0xXXX ways,
241-
or as an octal value preceded by \e.
242-
Caution: do not attempt to specify Ctl-A
241+
of the normal
242+
.Ar ddd ,
243+
.Li 0 Ns Ar ooo ,
244+
or
245+
.Li 0x Ns Ar hh
246+
ways,
247+
or as an octal value preceded by a backslash
248+
.Pq Ql \e .
249+
.Em Caution :
250+
do not attempt to specify
251+
.Ql \e^A
252+
.Pq Tn SOH
243253
as
244-
.Dq -R 1
254+
.Sq Fl R Li 1
245255
which will not do what was intended at all!
246256
The default record separator is newline.
247257
.It Fl t Ar char
@@ -253,9 +263,12 @@ is not considered to be part of a field when determining
253263
key offsets (see below).
254264
Each occurrence of
255265
.Ar char
256-
is significant (for example,
257-
.Dq Ar charchar
258-
delimits an empty field).
266+
is significant
267+
.Po
268+
for example,
269+
.Sq Ao Ar char Ac Ns Aq Ar char
270+
delimits an empty field
271+
.Pc .
259272
If
260273
.Fl t
261274
is not specified, the default field separator is a sequence of
@@ -292,7 +305,7 @@ first field.
292305
Fields are specified
293306
by the
294307
.Fl k
295-
.Ar kstart Ns Op \&, Ns Ar kend
308+
.Ar kstart Ns Op Cm \&, Ns Ar kend
296309
argument.
297310
A missing
298311
.Ar kend
@@ -303,91 +316,97 @@ The arguments
303316
and
304317
.Ar kend
305318
have the form
306-
.Ar m Ns Li \&. Ns Ar n
319+
.Ar m Ns Op Cm \&. Ns Ar n
320+
.Pq Ar m\^ , n No > 0
307321
and can be followed by one or more of the letters
308322
.Cm b , d , f , i ,
309323
.Cm l , n ,
310324
and
311325
.Cm r ,
312326
which correspond to the options discussed above.
327+
.Pp
313328
A
314329
.Ar kstart
315330
position specified by
316-
.Ar m Ns Li \&. Ns Ar n
317-
.Pq Ar m , n No > 0
331+
.Ar m Ns Cm \&. Ns Ar n
318332
is interpreted as the
319-
.Ar n Ns th
333+
.Ar n Ap th
320334
character in the
321-
.Ar m Ns th
335+
.Ar m Ap th
322336
field.
323337
A missing
324-
.Li \&. Ns Ar n
338+
.Cm \&. Ns Ar n
325339
in
326340
.Ar kstart
327341
means
328-
.Ql \&.1 ,
342+
.Sq Cm \&.1 ,
329343
indicating the first character of the
330-
.Ar m Ns th
344+
.Ar m Ap th
331345
field; if the
332346
.Fl b
333347
option is in effect,
334348
.Ar n
335349
is counted from the first non-blank character in the
336-
.Ar m Ns th
350+
.Ar m Ap th
337351
field;
338-
.Ar m Ns Li \&.1b
352+
.Ar m Ns Cm \&.1b
339353
refers to the first non-blank character in the
340-
.Ar m Ns th
354+
.Ar m Ap th
341355
field.
342356
.Pp
343357
A
344358
.Ar kend
345359
position specified by
346-
.Ar m Ns Li \&. Ns Ar n
360+
.Ar m Ns Cm \&. Ns Ar n
347361
is interpreted as
348362
the
349-
.Ar n Ns th
350-
character (including separators) of the
351-
.Ar m Ns th
363+
.Ar n Ap th
364+
character
365+
.Pq including separators
366+
of the
367+
.Ar m Ap th
352368
field.
353369
A missing
354-
.Li \&. Ns Ar n
370+
.Cm \&. Ns Ar n
355371
indicates the last character of the
356-
.Ar m Ns th
372+
.Ar m Ap th
357373
field;
358374
.Ar m
359375
= \&0
360376
designates the end of a line.
377+
.Pp
361378
Thus the option
362379
.Fl k
363380
.Sm off
364-
.Xo
365-
.Ar v Li \&. Ar x Li \&,
366-
.Ar w Li \&. Ar y
367-
.Xc
381+
.Ar v Cm \&. Ar x Cm \&, Ar w Cm \&. Ar y
382+
.Sm on
383+
is synonymous with the obsolescent options
384+
.Sm off
385+
.Cm \(pl Ar v\^ Li \-1 Cm \&. Ar x\^ Li \-1
368386
.Sm on
369-
is synonymous with the obsolescent option
370387
.Sm off
371-
.Cm \(pl Ar v-\&1 Li \&. Ar x-\&1
372-
.Fl Ar w-\&1 Li \&. Ar y ;
388+
.Fl Ar w\^ Li \-1 Cm \&. Ar y .
373389
.Sm on
374-
when
390+
.
391+
When
375392
.Ar y
376393
is omitted,
377394
.Fl k
378395
.Sm off
379-
.Ar v Li \&. Ar x Li \&, Ar w
396+
.Ar v Cm \&. Ar x Cm \&, Ar w
380397
.Sm on
381398
is synonymous with
382399
.Sm off
383-
.Cm \(pl Ar v-\&1 Li \&. Ar x-\&1
384-
.Fl Ar w+1 Li \&.0 .
400+
.Cm \(pl Ar v\^ Li \-1 Cm \&. Ar x\^ Li \-1
401+
.Sm on
402+
.Sm off
403+
.Fl Ar w\^ Li +1 Cm \&.0 .
385404
.Sm on
386405
The obsolescent
387406
.Cm \(pl Ns Ar pos1
388407
.Fl Ns Ar pos2
389-
option is still supported, except for
390-
.Fl Ns Ar w Ns Li \&.0b ,
408+
options are still supported, except for
409+
.Fl Ar w Ns Cm \&.0b ,
391410
which has no
392411
.Fl k
393412
equivalent.
@@ -435,19 +454,21 @@ environment variable as the path in which to store
435454
temporary files.
436455
.El
437456
.Sh FILES
438-
.Bl -tag -width outputNUMBER+some -compact
457+
.Bl -tag -width ".Ar output\^ Ns Aq Li NUMBER" -compact
439458
.It Pa /tmp/sort.*
440459
Default temporary files.
441-
.It Ar output Ns NUMBER
460+
.It Ar output\^ Ns Aq Li NUMBER
442461
Temporary file which is used for output if
443462
.Ar output
444463
already exists.
445464
Once sorting is finished, this file replaces
446465
.Ar output
447-
(via
466+
.Po
467+
via
448468
.Xr link 2
449469
and
450-
.Xr unlink 2 ) .
470+
.Xr unlink 2
471+
.Pc .
451472
.El
452473
.Sh EXAMPLES
453474
To silently check if the lines in a file are sorted lexicographically,

0 commit comments

Comments
 (0)