2019-12-01 17:39:17 +01:00
|
|
|
# compact
|
|
|
|
|
|
|
|
This command allows us to filters out rows with empty columns. Other commands are capable of feeding `compact` with their output through pipelines.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
```shell
|
|
|
|
> [input-command] | compact [column-name]
|
|
|
|
```
|
|
|
|
|
2020-03-13 18:23:41 +01:00
|
|
|
## Examples
|
2019-12-01 17:39:17 +01:00
|
|
|
|
|
|
|
Let's say we have a table like this:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
> open contacts.json
|
|
|
|
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ name │ email
|
|
|
|
───┼──────────┼──────────────────
|
|
|
|
0 │ paul │ paul@example.com
|
|
|
|
1 │ andres │
|
|
|
|
2 │ jonathan │
|
|
|
|
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
|
|
|
|
```
|
|
|
|
|
|
|
|
`compact` allows us to filter out rows with empty `email` column:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
> open contacts.json | compact email
|
|
|
|
━━━━━━┯━━━━━━━━━━━━━━━━━━
|
|
|
|
name │ email
|
|
|
|
──────┼──────────────────
|
|
|
|
paul │ paul@example.com
|
|
|
|
━━━━━━┷━━━━━━━━━━━━━━━━━━
|
|
|
|
```
|