mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
5ca9e12b7f
* Remove EOL whitespace in files other than docs * Break paragraphs into lines See http://rhodesmill.org/brandon/2012/one-sentence-per-line/ for the rationale * Fix various typos * Remove EOL whitespace in docs/commands/*.md
1.5 KiB
1.5 KiB
prepend
This command prepends the given row to the front of the table
Note:
prepend
does not change a file itself. If you want to save your changes, you need to run thesave
command- if you want to add something containing a whitespace character, you need to put it in quotation marks
Examples
Let's complete this table with the missing continents:
> open continents.txt | lines
━━━┯━━━━━━━━━━━━━━━
# │ <value>
───┼───────────────
0 │ Africa
1 │ South America
2 │ Australia
3 │ Europe
4 │ Antarctica
━━━┷━━━━━━━━━━━━━━━
You can add a new row at the top by using prepend
:
> open continents.txt | lines | prepend Asia
━━━┯━━━━━━━━━━━━━━━
# │ <value>
───┼───────────────
0 │ Asia
1 │ Africa
2 │ South America
3 │ Australia
4 │ Europe
5 │ Antarctica
━━━┷━━━━━━━━━━━━━━━
It's not possible to add multiple rows at once, so you'll need to call prepend
multiple times:
> open continents.txt | lines | prepend Asia | prepend "North America"
━━━┯━━━━━━━━━━━━━━━
# │ <value>
───┼───────────────
0 │ North America
1 │ Asia
2 │ Africa
3 │ South America
4 │ Australia
5 │ Europe
6 │ Antarctica
━━━┷━━━━━━━━━━━━━━━