nushell/docs/commands/format.md

28 lines
431 B
Markdown
Raw Normal View History

---
title: format
layout: command
version: 0.59.1
---
2019-11-30 21:15:12 +01:00
Format columns into a string using a simple pattern.
2019-11-30 21:15:12 +01:00
## Signature
2019-11-30 21:15:12 +01:00
```> format (pattern)```
2019-11-30 21:15:12 +01:00
## Parameters
2019-11-30 21:15:12 +01:00
- `pattern`: the pattern to output. e.g.) "{foo}: {bar}"
2019-11-30 21:15:12 +01:00
## Examples
2019-11-30 21:15:12 +01:00
Print filenames with their sizes
2019-11-30 21:15:12 +01:00
```shell
> ls | format '{name}: {size}'
2019-11-30 21:15:12 +01:00
```
Print elements from some columns of a table
2019-11-30 21:15:12 +01:00
```shell
> echo [[col1, col2]; [v1, v2] [v3, v4]] | format '{col2}'
```