nushell/docs/commands/compact.md

33 lines
600 B
Markdown
Raw Normal View History

---
title: compact
layout: command
version: 0.59.1
---
2019-12-01 17:39:17 +01:00
Creates a table with non-empty rows.
2019-12-01 17:39:17 +01:00
## Signature
```> compact ...columns```
2019-12-01 17:39:17 +01:00
## Parameters
- `...columns`: the columns to compact from the table
2019-12-01 17:39:17 +01:00
## Examples
2019-12-01 17:39:17 +01:00
Filter out all records where 'Hello' is null (returns nothing)
2019-12-01 17:39:17 +01:00
```shell
> echo [["Hello" "World"]; [$nothing 3]]| compact Hello
2019-12-01 17:39:17 +01:00
```
Filter out all records where 'World' is null (Returns the table)
```shell
> echo [["Hello" "World"]; [$nothing 3]]| compact World
```
2019-12-01 17:39:17 +01:00
Filter out all instances of nothing from a list (Returns [1,2])
2019-12-01 17:39:17 +01:00
```shell
> echo [1, $nothing, 2] | compact
2019-12-01 17:39:17 +01:00
```