W3cubDocs

/Nushell

from tsv for formats

Parse text as .tsv and create table.

Signature

> from tsv {flags}

Flags

  • --comment, -c {string}: a comment character to ignore lines starting with it
  • --quote, -q {string}: a quote character to ignore separators in strings, defaults to '"'
  • --escape, -e {string}: an escape character for strings containing the quote character
  • --noheaders, -n: don't treat the first row as column names
  • --flexible, -: allow the number of fields in records to be variable
  • --no-infer, -: no field type inferencing
  • --trim, -t {string}: drop leading and trailing whitespaces around headers names and/or field values

Input/output types:

input output
string table

Examples

Convert tab-separated data to a table

>"ColA	ColB
1	2"|from tsv
╭───┬──────┬──────╮
# │ ColA │ ColB │
├───┼──────┼──────┤
012
╰───┴──────┴──────╯

Create a tsv file with header columns and open it

>$'c1(char tab)c2(char tab)c3(char nl)1(char tab)2(char tab)3'|savetsv-data|opentsv-data|from tsv

Create a tsv file without header columns and open it

>$'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2'|savetsv-data|opentsv-data|from tsv-n

Create a tsv file without header columns and open it, removing all unnecessary whitespaces

>$'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2'|savetsv-data|opentsv-data|from tsv--trimall

Create a tsv file without header columns and open it, removing all unnecessary whitespaces in the header names

>$'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2'|savetsv-data|opentsv-data|from tsv--trimheaders

Create a tsv file without header columns and open it, removing all unnecessary whitespaces in the field values

>$'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2'|savetsv-data|opentsv-data|from tsv--trimfields

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