W3cubDocs

/Nushell

detect columns for strings

Attempt to automatically split text into multiple columns.

Signature

> detect columns {flags}

Flags

  • --skip, -s {int}: number of rows to skip before detecting
  • --no-headers, -n: don't detect headers
  • --combine-columns, -c {range}: columns to be combined; listed as a range

Input/output types:

input output
string table

Examples

Splits string across multiple columns

>'a b c'|detect columns-n
╭───┬─────────┬─────────┬─────────╮
# │ column0 │ column1 │ column2 │
├───┼─────────┼─────────┼─────────┤
0abc
╰───┴─────────┴─────────┴─────────╯

>$'c1 c2 c3 c4 c5(char nl)a b c d e'|detect columns-c0..1

Splits a multi-line string into columns with headers detected

>$'c1 c2 c3 c4 c5(char nl)a b c d e'|detect columns-c-2..-1

Splits a multi-line string into columns with headers detected

>$'c1 c2 c3 c4 c5(char nl)a b c d e'|detect columns-c2..

Parse external ls command and combine columns for datetime

> ^ls-lh|detect columns--no-headers--skip1--combine-columns5..7

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/detect_columns.html