mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 15:58:19 +02:00
Auto-generate markdown command docs (#4451)
* Finish updating * a couple improvements * Update renames * cleanup examples
This commit is contained in:
@ -1,25 +1,24 @@
|
||||
# headers
|
||||
---
|
||||
title: headers
|
||||
layout: command
|
||||
version: 0.59.0
|
||||
---
|
||||
|
||||
Use `headers` to turn the first row of a table into meaningful column names.
|
||||
Use the first row of the table as column names.
|
||||
|
||||
As demonstrated in the following example, it's particularly handy when working with spreadsheets.
|
||||
## Signature
|
||||
|
||||
```> headers ```
|
||||
|
||||
## Examples
|
||||
|
||||
Returns headers from table
|
||||
```shell
|
||||
> open sample_data.ods | get SalesOrders
|
||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||
# │ Column0 │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6
|
||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||
0 │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||
1 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
||||
> "a b c|1 2 3" | split row "|" | split column " " | headers
|
||||
```
|
||||
|
||||
Don't panic on rows with different headers
|
||||
```shell
|
||||
> open sample_data.ods | get SalesOrders | headers
|
||||
────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬───────────
|
||||
# │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total
|
||||
────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼───────────
|
||||
0 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500
|
||||
1 │ 2018-01-23 │ Central │ Kivell │ Binder │ 50.0000 │ 19.9900 │ 999.4999
|
||||
> "a b c|1 2 3|1 2 3 4" | split row "|" | split column " " | headers
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user