Skip to content

Releases: shenwei356/csvtk

csvtk v0.3.5.1

21 Jun 10:51
Compare
Choose a tag to compare

fix minor bug of a dependency package. When reading lines ending with \r\n (usually from Windows OS), error will occur:

no data found in file test.csv

csvtk v0.3.5

31 May 11:00
Compare
Choose a tag to compare
  • fix minor bug of csv2md
  • add subcommand version which could check for update

_Recompiled at 2016-06-06 due to changed output of subcommand version_

csvtk v0.3.4

01 May 18:02
Compare
Choose a tag to compare
  • fix bug of csvtk replace that head row should not be edited.

csvtk v0.3.3

26 Apr 13:01
Compare
Choose a tag to compare
  • fix bug of csvtk grep -t -P

csvtk v0.3.2

25 Apr 06:05
Compare
Choose a tag to compare
  • fix bug of inter

csvtk v0.3.1

18 Apr 16:56
Compare
Choose a tag to compare
- add support of searching multiple fields for `grep`

_update 2016-04-24_

recompile due to bugfix of dependencies (https://github.com/shenwei356/util/)

csvtk v0.3

15 Apr 13:01
Compare
Choose a tag to compare
  • 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

csvtk v0.2.9

14 Apr 17:15
Compare
Choose a tag to compare
  • add more flags to subcommand pretty
  • fix bug of csvtk cut -n
  • add subcommand filter

filter

Usage

filter data by values of selected fields with math expression

Usage:
  csvtk filter [flags]

Flags:
      --any             print record if any of the field satisfy the condition
  -f, --filter string   filter condition. e.g. -f "age>12" or -f "1,3<=2" or -F -f "c*!=0" --or
  -F, --fuzzy-fields    using fuzzy fileds, e.g. *name or id123*

Examples

  1. single field

    $ cat names.csv
    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"
    
    $ cat names.csv | csvtk filter -f "id>0" | csvtk pretty
    id   first_name   last_name   username
    11   Rob          Pike        rob
    2    Ken          Thompson    ken
    4    Robert       Griesemer   gri
    1    Robert       Thompson    abc
    
  2. multiple fields

    $ cat digitals.tsv
    4       5       6
    1       2       3
    7       8       0
    8       1,000   4
    
    $ cat digitals.tsv | csvtk -t -H filter -f "1-3>0"
    4       5       6
    1       2       3
    8       1,000   4
    

    using --any to print record if any of the field satisfy the condition

    $  cat digitals.tsv | csvtk -t -H filter -f "1-3>0" --any
    4       5       6
    1       2       3
    7       8       0
    8       1,000   4
    
  3. fuzzy fields

    $  cat names.csv | csvtk filter -F -f "i*!=0"
    id,first_name,last_name,username
    11,Rob,Pike,rob
    2,Ken,Thompson,ken
    4,Robert,Griesemer,gri
    1,Robert,Thompson,abc
    

csvtk v0.2.8

13 Apr 12:21
Compare
Choose a tag to compare

pretty

Usage

convert CSV to readable aligned table

Usage:
  csvtk pretty [flags]

Flags:
  -r, --align-right        align right
  -s, --separator string   fields/columns separator (default "   ")

Examples:

  1. default

    $ csvtk pretty names.csv
    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
    
  2. align right

    $ csvtk pretty names.csv -r
    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
    
  3. custom separator

    $ csvtk pretty names.csv -s " | "
    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
    

csvtk v0.2.7

12 Apr 09:52
Compare
Choose a tag to compare
- fix highlight failing in windows