Skip to content

csvtk v0.3

Compare
Choose a tag to compare
@shenwei356 shenwei356 released this 15 Apr 13:01
· 471 commits to master since this release
  • add subcommand csv2md

csv2md

Usage

convert CSV to markdown format

Usage:
  csvtk csv2md [flags]

Flags:
  -a, --alignments string   comma separated alignments. e.g. -a l,c,c,c or -a c
  -w, --min-width int       min width (default 3)

Examples

  1. give single alignment symbol

    $ cat names.csv | csvtk csv2md -a left
    id |first_name|last_name|username
    :--|:---------|:--------|:-------
    11 |Rob       |Pike     |rob
    2  |Ken       |Thompson |ken
    4  |Robert    |Griesemer|gri
    1  |Robert    |Thompson |abc
    NA |Robert    |Abel     |12
    

    result:

    id first_name last_name username
    11 Rob Pike rob
    2 Ken Thompson ken
    4 Robert Griesemer gri
    1 Robert Thompson abc
    NA Robert Abel 12
  2. give alignment symbols of all fields

    $ cat names.csv | csvtk csv2md -a c,l,l,l
    id |first_name|last_name|username
    :-:|:---------|:--------|:-------
    11 |Rob       |Pike     |rob
    2  |Ken       |Thompson |ken
    4  |Robert    |Griesemer|gri
    1  |Robert    |Thompson |abc
    NA |Robert    |Abel     |123
    

    result

    id first_name last_name username
    11 Rob Pike rob
    2 Ken Thompson ken
    4 Robert Griesemer gri
    1 Robert Thompson abc
    NA Robert Abel 123