format
for strings> format {flags} (pattern)
pattern
: the pattern to output. e.g.) "{foo}: {bar}"input | output |
---|---|
record | any |
table | list<string> |
Print filenames with their sizes
>ls|format'{name}: {size}'
Print elements from some columns of a table
> [[col1, col2]; [v1, v2] [v3, v4]] |format'{col2}'
╭───┬────╮
│0│v2│
│1│v4│
╰───┴────╯
name | type | usage |
---|---|---|
format date |
Builtin | Format a given date using a format string. |
format duration |
Builtin | Outputs duration with a specified unit of time. |
format filesize |
Builtin | Converts a column of filesizes to some specified format. |
Tips: Command format
was not included in the official binaries by default, you have to build it with --features=extra
flag
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/format.html