mirror of
https://github.com/nushell/nushell
synced 2024-11-11 07:34:14 +00:00
1.3 KiB
1.3 KiB
default
This command sets a default row's column if missing. Other commands are capable of feeding default
with their output through pipelines.
Usage
> [input-command] | default [column-name] [column-value]
Examples
Let's say we have a table like this:
> open contacts.json
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━
# │ name │ email
───┼──────────┼──────────────────
0 │ paul │ paul@example.com
1 │ andres │
2 │ jonathan │
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━
default
allows us to fill email
column with a default value:
> open contacts.json | default email "no-reply@example.com"
━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━
# │ name │ email
───┼──────────┼──────────────────────
0 │ paul │ paul@example.com
1 │ andres │ no-reply@example.com
2 │ jonathan │ no-reply@example.com
━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━