decorate(1)

decorate - command-line calculations

Section 1 datamash bookworm source

Description

DECORATE

NAME

decorate - command-line calculations

SYNOPSIS

decorate [OPTION]... [INPUT]
decorate
--decorate [OPTION]... [INPUT]
decorate
--undecorate N [OPTION]... [INPUT]

DESCRIPTION

Converts (and optionally sorts) fields of various formats

With --decorate: adds the converted fields to the start of each line and prints and prints it to STDOUT; does not sort.

With --undecorate: removes the first N fields from the input; Use as post-processing step after sort(1).

Without --decorate and --undecorate: automatically decorates the input, runs sort(1) and undecorates the result; This is the easiest method to use.

General Options:

--decorate

decorate/convert the specified fields and print the output to STDOUT. Does not automatically run sort(1) or undecorates the output

--header=N

does not decorate or sort the first N lines

-H

same as --header=N

-k, --key=KEYDEF

key/field to sort; same syntax as sort(1), optionally followed by ’:method’ to convert to the field into a sortable value; see examples and available conversion below

-t, --field-separator=SEP

use SEP instead of non-blank to blank transition

--print-sort-args

print adjusted parameters for sort(1); Useful when using --decorate and then manually running sort(1)

--undecorate=N

removes the first N fields

-z, --zero-terminated

line delimiter is NUL, not newline

--help

display this help and exit

--version

output version information and exit

The following options are passed to sort(1) as-is:

-c, --check

--compress-program

--random-source

-s, --stable

--batch-size

-S, --buffer-size

-T, --temporary-directory

-u, --unique

--parallel

Available conversions methods (use with -k):

as-is

copy as-is

roman

roman numerals

strlen

length (in bytes) of the specified field

ipv4

dotted-decimal IPv4 addresses

ipv6

IPv6 addresses

ipv4inet

number-and-dots IPv4 addresses (incl. octal, hex values)

EXAMPLES

OVERVIEW

The decorate program allows sorting input according to various ordering, e.g. IP addresses, roman numerals, etc. It works in tandem with sort(1) to perform the actual sorting.