Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

columns for filters

Given a record or table, produce a list of its columns' names.

Signature

> columns {flags}

Input/output types:

inputoutput
tablelist<string>
recordlist<string>

Examples

Get the columns from the record

> { acronym:PWD, meaning:'Print Working Directory' } | columns
╭───┬─────────╮
│ 0 │ acronym │
│ 1 │ meaning │
╰───┴─────────╯

Get the columns from the table

> [[name,age,grade]; [bill,20,a]] | columns
╭───┬───────╮
│ 0 │ name  │
│ 1 │ age   │
│ 2 │ grade │
╰───┴───────╯

Get the first column from the table

> [[name,age,grade]; [bill,20,a]] | columns | first

Get the second column from the table

> [[name,age,grade]; [bill,20,a]] | columns | select 1

Notes

This is a counterpart to values, which produces a list of columns' values.