1DECORATE(1)                      User Commands                     DECORATE(1)
2
3
4

NAME

6       decorate - command-line calculations
7

SYNOPSIS

9       decorate [OPTION]... [INPUT]
10       decorate --decorate [OPTION]... [INPUT]
11       decorate --undecorate N [OPTION]... [INPUT]
12

DESCRIPTION

14       Converts (and optionally sorts) fields of various formats
15
16       With  --decorate:  adds  the converted fields to the start of each line
17       and prints and prints it to STDOUT; does not sort.
18
19       With --undecorate: removes the first N fields from the  input;  Use  as
20       post-processing step after sort(1).
21
22       Without --decorate and --undecorate: automatically decorates the input,
23       runs sort(1) and undecorates the result; This is the easiest method  to
24       use.
25
26   General Options:
27       --decorate
28              decorate/convert  the  specified  fields and print the output to
29              STDOUT. Does not automatically run sort(1)  or  undecorates  the
30              output
31
32       --header=N
33              does not decorate or sort the first N lines
34
35       -H     same as --header=N
36
37       -k, --key=KEYDEF
38              key/field  to  sort; same syntax as sort(1), optionally followed
39              by ':method' to convert to the field into a sortable value;  see
40              examples and available conversion below
41
42       -t, --field-separator=SEP
43              use SEP instead of non-blank to blank transition
44
45       --print-sort-args
46              print adjusted parameters for sort(1); Useful when using --deco‐
47              rate and then manually running sort(1)
48
49       --undecorate=N
50              removes the first N fields
51
52       -z, --zero-terminated
53              line delimiter is NUL, not newline
54
55       --help display this help and exit
56
57       --version
58              output version information and exit
59
60       The following options are passed to sort(1) as-is:
61
62       -c, --check
63
64       --compress-program
65
66       --random-source
67
68       -s, --stable
69
70       --batch-size
71
72       -S, --buffer-size
73
74       -T, --temporary-directory
75
76       -u, --unique
77
78       --parallel
79
80       Available conversions methods (use with -k):
81
82       as-is  copy as-is
83
84       roman  roman numerals
85
86       strlen length (in bytes) of the specified field
87
88       ipv4   dotted-decimal IPv4 addresses
89
90       ipv6   IPv6 addresses
91
92       ipv4inet
93              number-and-dots IPv4 addresses (incl. octal, hex values)
94

EXAMPLES

OVERVIEW

97       The decorate program allows sorting input according to  various  order‐
98       ing,  e.g.  IP addresses, roman numerals, etc.  It works in tandem with
99       sort(1) to perform the actual sorting.
100
101       The idea was suggested by Pádraig Brady in https://lists.gnu.org/r/bug-
102       coreutils/2015-06/msg00076.html:
103
104       1.  Decorate:  convert  the  input  to  a sortable-format as additional
105       fields
106       2. Sort according to the inserted fields
107       3. Undecorate: remove the inserted fields
108
109       Example of preparing to sort by roman numerals:
110
111              $ printf "%s\n" C V III IX XI | decorate -k1,1:roman --decorate
112              0000100 C
113              0000005 V
114              0000003 III
115              0000009 IX
116              0000011 XI
117
118       The  output  can  now  be  sent  to  sort(1),  followed   by   removing
119       (=undecorate) the first field.
120
121
122              $ printf "%s\n" C V III IX XI \
123                     | decorate -k1,1:roman --decorate \
124                     | sort -k1,1 \
125                     | decorate --undecorate 1
126              III
127              V
128              IX
129              XI
130              C
131
132       decorate(1)  can  automatically  combine  the  decorate-sort-undecorate
133       steps (when run without --decorate or --undecorate):
134
135
136              $ printf "%s\n" C V III IX XI | decorate -k1,1:roman
137              III
138              V
139              IX
140              XI
141              C
142

ADDITIONAL INFORMATION

144       See GNU Datamash Website (https://www.gnu.org/software/datamash)
145

AUTHOR

147       Written by Assaf Gordon.
148
150       Copyright © 2020 Assaf Gordon License GPLv3+:  GNU  GPL  version  3  or
151       later <https://gnu.org/licenses/gpl.html>.
152       This  is  free  software:  you  are free to change and redistribute it.
153       There is NO WARRANTY, to the extent permitted by law.
154

SEE ALSO

156       The full documentation for decorate is maintained as a Texinfo  manual.
157       If  the info and decorate programs are properly installed at your site,
158       the command
159
160              info decorate
161
162       should give you access to the complete manual.
163
164
165
166decorate 1.7                      April 2020                       DECORATE(1)
Impressum