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

NAME

6       decorate - convert fields of various formats
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.   The  decorate  program allows sorting input according to various
25       ordering, e.g. IP addresses, roman numerals, etc.  It works  in  tandem
26       with sort(1) to perform the actual sorting.
27
28       The idea was suggested by Pádraig Brady in https://lists.gnu.org/r/bug-
29       coreutils/2015-06/msg00076.html:
30
31       1. Decorate: convert the  input  to  a  sortable-format  as  additional
32       fields
33       2. Sort according to the inserted fields
34       3. Undecorate: remove the inserted fields
35

OPTIONS

37   General Options:
38       --decorate
39              decorate/convert  the  specified  fields and print the output to
40              STDOUT. Does not automatically run sort(1)  or  undecorates  the
41              output
42
43       --header=N
44              does not decorate or sort the first N lines
45
46       -H     same as --header=N
47
48       -k, --key=KEYDEF
49              key/field  to  sort; same syntax as sort(1), optionally followed
50              by ':method' to convert to the field into a sortable value;  see
51              examples and available conversion below
52
53       -t, --field-separator=SEP
54              use SEP instead of non-blank to blank transition
55
56       --print-sort-args
57              print   adjusted  parameters  for  sort(1);  Useful  when  using
58              --decorate and then manually running sort(1)
59
60       --undecorate=N
61              removes the first N fields
62
63       -z, --zero-terminated
64              line delimiter is NUL, not newline
65
66       --sort-cmd=/path/to/sort
67              Alternative sort(1) to use.
68
69       --help display this help and exit
70
71       --version
72              output version information and exit
73
74       The following options are passed to sort as-is (Most of them assume GNU
75       sort):
76
77       -c, --check
78
79       --compress-program
80
81       --random-source
82
83       -s, --stable
84
85       --batch-size
86
87       -S, --buffer-size
88
89       -T, --temporary-directory
90
91       -u, --unique
92
93       --parallel
94
95       Available conversions methods (use with -k):
96
97       as-is  copy as-is
98
99       roman  roman numerals
100
101       strlen length (in bytes) of the specified field
102
103       ipv4   dotted-decimal IPv4 addresses
104
105       ipv6   IPv6 addresses
106
107       ipv4inet
108              number-and-dots IPv4 addresses (incl. octal, hex values)
109
110       ipv6v4map
111              IPv6 and IPv4 (as IPv4-Mapped IPv6) addresses
112
113       ipv6v4comp
114              IPv6 and IPv4 (as IPv4-Compatible IPv6) addresses
115

EXAMPLES

117       Example of preparing to sort by roman numerals:
118
119              $ printf "%s\n" C V III IX XI | decorate -k1,1:roman --decorate
120              0000100 C
121              0000005 V
122              0000003 III
123              0000009 IX
124              0000011 XI
125
126       The   output   can  now  be  sent  to  sort(1),  followed  by  removing
127       (=undecorate) the first field.
128
129
130              $ printf "%s\n" C V III IX XI \
131                     | decorate -k1,1:roman --decorate \
132                     | sort -k1,1 \
133                     | decorate --undecorate 1
134              III
135              V
136              IX
137              XI
138              C
139
140       decorate(1)  can  automatically  combine  the  decorate-sort-undecorate
141       steps (when run without --decorate or --undecorate):
142
143
144              $ printf "%s\n" C V III IX XI | decorate -k1,1:roman
145              III
146              V
147              IX
148              XI
149              C
150

ADDITIONAL INFORMATION

152       See GNU Datamash Website (https://www.gnu.org/software/datamash)
153

AUTHOR

155       Written by Assaf Gordon, Shawn Wagner and Erik Auerswald.
156
158       Copyright  ©  2022  Assaf  Gordon  License GPLv3+: GNU GPL version 3 or
159       later <https://gnu.org/licenses/gpl.html>.
160       This is free software: you are free  to  change  and  redistribute  it.
161       There is NO WARRANTY, to the extent permitted by law.
162

SEE ALSO

164       The  full documentation for decorate is maintained as a Texinfo manual.
165       If the info and decorate programs are properly installed at your  site,
166       the command
167
168              info decorate
169
170       should give you access to the complete manual.
171
172
173
174decorate 1.8-dirty                 July 2022                       DECORATE(1)
Impressum