nushell/docs/commands/compact.md
2019-12-01 17:44:43 +01:00

1.1 KiB

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

> [input-command] | compact [column-name]

Examples

Let's say we have a table like this:

> 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:

> open contacts.json | compact email
━━━━━━┯━━━━━━━━━━━━━━━━━━
 name │ email
──────┼──────────────────
 paul │ paul@example.com
━━━━━━┷━━━━━━━━━━━━━━━━━━