Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add shenwei356/csvtk #6570

Merged
merged 2 commits into from Sep 27, 2022

Conversation

ponkio-o
Copy link
Sponsor Contributor

@ponkio-o ponkio-o commented Sep 27, 2022

#6570 shenwei356/csvtk: A cross-platform, efficient and practical CSV/TSV toolkit in Golang

$ aqua g -i shenwei356/csvtk

How to confirm if this package works well

Reviewers aren't necessarily familiar with this package, so please describe how to confirm if this package works well.
Please confirm if this package works well yourself as much as possible.

Command and output

$ csvtk --help
csvtk -- a cross-platform, efficient and practical CSV/TSV toolkit

Version: 0.25.0

Author: Wei Shen <shenwei356@gmail.com>

Documents  : http://shenwei356.github.io/csvtk
Source code: https://github.com/shenwei356/csvtk

Attention:

  1. The CSV parser requires all the lines have same number of fields/columns.
     Even lines with spaces will cause error.
     Use '-I/--ignore-illegal-row' to skip these lines if neccessary.
  2. By default, csvtk thinks your files have header row, if not, switch flag "-H" on.
  3. Column names better be unique.
  4. By default, lines starting with "#" will be ignored, if the header row
     starts with "#", please assign flag "-C" another rare symbol, e.g. '$'.
  5. By default, csvtk handles CSV files, use flag "-t" for tab-delimited files.
  6. If double quotes exist in fields, use flag "-l".
  7. Do not mix use field (column) numbers and names.

Environment variables for frequently used global flags:

  - "CSVTK_T" for flag "-t/--tabs"
  - "CSVTK_H" for flag "-H/--no-header-row"

You can also create a soft link named "tsvtk" for "csvtk",
which sets "-t/--tabs" by default.

Usage:
  csvtk [command]

Available Commands:
  add-header      add column names
  cat             stream file to stdout and report progress on stderr
  comb            compute combinations of items at every row
  concat          concatenate CSV/TSV files by rows
  corr            calculate Pearson correlation between two columns
  csv2json        convert CSV to JSON format
  csv2md          convert CSV to markdown format
  csv2rst         convert CSV to reStructuredText format
  csv2tab         convert CSV to tabular format
  csv2xlsx        convert CSV/TSV files to XLSX file
  cut             select and arrange fields
  del-header      delete column names
  dim             dimensions of CSV file
  filter          filter rows by values of selected fields with arithmetic expression
  filter2         filter rows by awk-like arithmetic/string expressions
  fmtdate         format date of selected fields
  fold            fold multiple values of a field into cells of groups
  freq            frequencies of selected fields
  gather          gather columns into key-value pairs
  genautocomplete generate shell autocompletion script (bash|zsh|fish|powershell)
  grep            grep data by selected fields with patterns/regular expressions
  head            print first N records
  headers         print headers
  inter           intersection of multiple files
  join            join files by selected fields (inner, left and outer join)
  mutate          create new column from selected fields by regular expression
  mutate2         create new column from selected fields by awk-like arithmetic/string expressions
  ncol            print number of columns
  nrow            print number of records
  plot            plot common figures
  pretty          convert CSV to readable aligned table
  rename          rename column names with new names
  rename2         rename column names by regular expression
  replace         replace data of selected fields by regular expression
  round           round float to n decimal places
  sample          sampling by proportion
  sep             separate column into multiple columns
  sort            sort by selected fields
  space2tab       convert space delimited format to CSV
  split           split CSV/TSV into multiple files according to column values
  splitxlsx       split XLSX sheet into multiple sheets according to column values
  summary         summary statistics of selected numeric or text fields (groupby group fields)
  tab2csv         convert tabular format to CSV
  transpose       transpose CSV data
  unfold          unfold multiple values in cells of a field
  uniq            unique data without sorting
  version         print version information and check for update
  watch           monitor the specified fields
  xlsx2csv        convert XLSX to CSV format

Flags:
  -c, --chunk-size int         chunk size of CSV reader (default 50)
  -C, --comment-char string    lines starting with commment-character will be ignored. if your header row starts with '#', please assign "-C" another rare symbol, e.g. '$' (default "#")
  -d, --delimiter string       delimiting character of the input CSV file (default ",")
  -h, --help                   help for csvtk
  -E, --ignore-empty-row       ignore empty rows
  -I, --ignore-illegal-row     ignore illegal rows
      --infile-list string     file of input files list (one file per line), if given, they are appended to files from cli arguments
  -l, --lazy-quotes            if given, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field
  -H, --no-header-row          specifies that the input CSV file does not have header row
  -j, --num-cpus int           number of CPUs to use (default value depends on your computer) (default 16)
  -D, --out-delimiter string   delimiting character of the output CSV file, e.g., -D $'\t' for tab (default ",")
  -o, --out-file string        out file ("-" for stdout, suffix .gz for gzipped out) (default "-")
  -T, --out-tabs               specifies that the output is delimited with tabs. Overrides "-D"
  -t, --tabs                   specifies that the input CSV file is delimited with tabs. Overrides "-d"

Use "csvtk [command] --help" for more information about a command.

If files such as configuration file are needed, please share them.

$ cat testdata/data4json.csv 
ID,room,name,status
3,G13,Simon,true
5,103,Anna,TRUE
1e-3,2,,N/A

$ cat testdata/data4json.csv | csvtk csv2json
[
  {
    "ID": "3",
    "room": "G13",
    "name": "Simon",
    "status": true
  },
  {
    "ID": "5",
    "room": "103",
    "name": "Anna",
    "status": true
  },
  {
    "ID": "1e-3",
    "room": "2",
    "name": null,
    "status": null
  }
]

Reference

[shenwei356/csvtk](https://github.com/shenwei356/csvtk): A cross-platform, efficient and practical CSV/TSV toolkit in Golang

```console
$ aqua g -i shenwei356/csvtk
```

## How to confirm if this package works well

Reviewers aren't necessarily familiar with this package, so please describe how to confirm if this package works well.
Please confirm if this package works well yourself as much as possible.

Command and output

```console
$
```

If files such as configuration file are needed, please share them.

```
```

Reference

-
@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label Sep 27, 2022
@suzuki-shunsuke suzuki-shunsuke added this to the v3.61.1 milestone Sep 27, 2022
@suzuki-shunsuke
Copy link
Member

Thanks!

@suzuki-shunsuke suzuki-shunsuke merged commit 4b93da6 into aquaproj:main Sep 27, 2022
@suzuki-shunsuke
Copy link
Member

@ponkio-o ponkio-o deleted the feat/shenwei356/csvtk branch September 28, 2022 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants