format pattern for strings

Format columns into a string using a simple pattern.

WARNING

Command format pattern was not included in the official binaries by default, you have to build it with --features=extra flag

Signature

> format pattern {flags} (pattern)

Parameters

  • pattern: the pattern to output. e.g.) "{foo}: {bar}"

Input/output types:

inputoutput
recordany
tablelist<string>

Examples

Print filenames with their sizes

> ls | format pattern '{name}: {size}'

Print elements from some columns of a table

> [[col1, col2]; [v1, v2] [v3, v4]] | format pattern '{col2}'
╭───┬────╮
 0  v2 
 1  v4 
╰───┴────╯