Debian Codegraph @

man/decorate.x

raw
1 ." GNU decorate - manual page
2 ." Copyright (C) 2014-2021 Assaf Gordon <[email protected]>
3 [NAME]
4 decorate - convert fields of various formats
5
6
7 [>DESCRIPTION]
8 The \fBdecorate\fR program allows sorting input according to various
9 ordering, e.g. IP addresses, roman numerals, etc.
10 It works in tandem with sort(1) to perform the actual sorting.
11
12 The idea was suggested by
13 .UR https://lists.gnu.org/r/bug-coreutils/2015-06/msg00076.html
14 Pádraig Brady in https://lists.gnu.org/r/bug-coreutils/2015-06/msg00076.html:
15
16 1. Decorate: convert the input to a sortable-format as additional fields
17 .br
18 2. Sort according to the inserted fields
19 .br
20 3. Undecorate: remove the inserted fields
21
22 [=EXAMPLES]
23 Example of preparing to sort by roman numerals:
24 .PP
25 .nf
26 .RS
27 $ printf "%s\\n" C V III IX XI | \fBdecorate\fR \-k1,1:roman \-\-decorate
28 0000100 C
29 0000005 V
30 0000003 III
31 0000009 IX
32 0000011 XI
33 .RE
34 .fi
35 .PP
36
37 The output can now be sent to sort(1), followed by removing (=undecorate)
38 the first field.
39
40 .PP
41 .nf
42 .RS
43 $ printf "%s\\n" C V III IX XI \\
44 | \fBdecorate\fR \-k1,1:roman \-\-decorate \\
45 | sort \-k1,1 \\
46 | \fBdecorate\fR \-\-undecorate 1
47 III
48 V
49 IX
50 XI
51 C
52 .RE
53 .fi
54 .PP
55
56 \fBdecorate(1)\fR can automatically combine the decorate-sort-undecorate steps
57 (when run without \-\-decorate or \-\-undecorate):
58
59 .PP
60 .nf
61 .RS
62 $ printf "%s\\n" C V III IX XI | \fBdecorate\fR \-k1,1:roman
63 III
64 V
65 IX
66 XI
67 C
68 .RE
69 .fi
70 .PP
71
72
73
74
75
76 [ADDITIONAL INFORMATION]
77 See
78 .UR https://www.gnu.org/software/datamash
79 GNU Datamash Website (https://www.gnu.org/software/datamash)