nushell/docs/commands/format.md

28 lines
431 B
Markdown
Raw Normal View History

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