Skip to content

Commit

Permalink
update doc for 0.21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Oct 30, 2020
1 parent e7b7222 commit ee864e3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 28 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.21.0/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.21.0)
- new command: `csvtk nrow/ncol` for printing number of rows or columns.
- new command: `round` to round float to n decimal places. [#112](https://github.com/shenwei356/csvtk/issues/112)
- `csvtk headers`: new flag `-v/--verbose`.
- `csvtk headers`: file name and column index is optional outputted with new flag `-v/--verbose`.
- `csvtk dim`: new flags `--tabluar`, `--cols`, `--rows`, `-n/--no-files`.
- `csvtk dim/ncol/nrow`: can handle empty files now. [#108](https://github.com/shenwei356/csvtk/issues/108)
- `csvtk csv2json` [#104](https://github.com/shenwei356/csvtk/issues/104):
- new flag `-b/--blank`: do not convert "", "na", "n/a", "none", "null", "." to null
- new flag `-n/--parse-num`: parse numeric values for nth column(s), multiple values are supported and "a"/"all" for all columns.
- `csvtk xlsx2csv`: fix output for ragged table. [#110](https://github.com/shenwei356/csvtk/issues/110)
- `csvtk join`: fix bug for joining >2 files.
- `csvtk freq`: new flag `-n/--keep-n` for keeping first N records of every key.
- `csvtk uniq`: new flag `-n/--keep-n` for keeping first N records of every key.
- [csvtk v0.20.0](https://github.com/shenwei356/csvtk/releases/tag/v0.20.0)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.20.0/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.20.0)
- new command `csvtk comb`: compute combinations of items at every row.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ It could save you lots of time in (not) writing Python/R scripts.

## Subcommands

41 subcommands in total.
45 subcommands in total.

**Information**

Expand Down
2 changes: 1 addition & 1 deletion csvtk/cmd/uniq.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ func init() {
uniqCmd.Flags().StringP("fields", "f", "1", `select these fields as keys. e.g -f 1,2 or -f columnA,columnB`)
uniqCmd.Flags().BoolP("ignore-case", "i", false, `ignore case`)
uniqCmd.Flags().BoolP("fuzzy-fields", "F", false, `using fuzzy fields, e.g., -F -f "*name" or -F -f "id123*"`)
uniqCmd.Flags().IntP("keep-n", "n", 1, `keep at most N recordss for a key`)
uniqCmd.Flags().IntP("keep-n", "n", 1, `keep at most N records for a key`)

}
2 changes: 1 addition & 1 deletion csvtk/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
)

// VERSION of csvtk
const VERSION = "0.20.0"
const VERSION = "0.21.0"

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Expand Down
29 changes: 13 additions & 16 deletions doc/docs/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@

## Current Version

- [csvtk v0.20.0](https://github.com/shenwei356/csvtk/releases/tag/v0.20.0)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.20.0/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.20.0)
- new command `csvtk comb`: compute combinations of items at every row.
- new command `csvtk sep`: separate column into multiple columns. [#96](https://github.com/shenwei356/csvtk/issues/96)
- `csvtk`:
- list lines' number of illegal (`-I`) and empty (`-E`) rows. [#97](https://github.com/shenwei356/csvtk/issues/97)
- new flag `--infile-list` for giving file of input files list (one file per line), if given, they are appended to files from cli arguments
- `csvtk join`:
- reenable flag `-i/--ignore-case`. [#99](https://github.com/shenwei356/csvtk/issues/99)
- **outer join is supported**. [#23](https://github.com/shenwei356/csvtk/issues/23)
- new flag `-L/--left-join`: left join, equals to -k/--keep-unmatched, exclusive with `--outer-join`
- new flag `-O/--outer-join`: outer join, exclusive with --left-join
- rename flag `--fill` to `--na`.
- `csvtk filter2`: fix bug when column names start with digits, e.g., `1000g2015aug`. Thank @VorontsovIE ([#44](https://github.com/shenwei356/csvtk/issues/44))
- `csvtk concat`: allow one input file. [#98](https://github.com/shenwei356/csvtk/issues/98)
- `csvtk mutate`: new flag `-R/--remove` for removing input column.
- [csvtk v0.21.0](https://github.com/shenwei356/csvtk/releases/tag/v0.21.0)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.21.0/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.21.0)
- new command: `csvtk nrow/ncol` for printing number of rows or columns.
- new command: `round` to round float to n decimal places. [#112](https://github.com/shenwei356/csvtk/issues/112)
- `csvtk headers`: file name and column index is optional outputted with new flag `-v/--verbose`.
- `csvtk dim`: new flags `--tabluar`, `--cols`, `--rows`, `-n/--no-files`.
- `csvtk dim/ncol/nrow`: can handle empty files now. [#108](https://github.com/shenwei356/csvtk/issues/108)
- `csvtk csv2json` [#104](https://github.com/shenwei356/csvtk/issues/104):
- new flag `-b/--blank`: do not convert "", "na", "n/a", "none", "null", "." to null
- new flag `-n/--parse-num`: parse numeric values for nth column(s), multiple values are supported and "a"/"all" for all columns.
- `csvtk xlsx2csv`: fix output for ragged table. [#110](https://github.com/shenwei356/csvtk/issues/110)
- `csvtk join`: fix bug for joining >2 files.
- `csvtk uniq`: new flag `-n/--keep-n` for keeping first N records of every key.

Links:

Expand Down
46 changes: 39 additions & 7 deletions doc/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Usage
```text
csvtk -- a cross-platform, efficient and practical CSV/TSV toolkit
Version: 0.20.0
Version: 0.21.0
Author: Wei Shen <[email protected]>
Expand Down Expand Up @@ -154,6 +154,7 @@ Available Commands:
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
Expand Down Expand Up @@ -183,6 +184,8 @@ Flags:
-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" and "-D"
Use "csvtk [command] --help" for more information about a command.
```

## headers
Expand All @@ -195,22 +198,28 @@ print headers
Usage:
csvtk headers [flags]
Flags:
-h, --help help for headers
-v, --verbose print verbose information
```

Examples

```sh
$ csvtk headers testdata/*.csv
$ csvtk headers testdata/[12].csv
name
attr
name
major

$ csvtk headers testdata/[12].csv -v
# testdata/1.csv
1 name
2 attr
# testdata/2.csv
1 name
2 major
# testdata/3.csv
1 id
2 name
3 hobby
```

## dim/nrow/ncol
Expand Down Expand Up @@ -1191,9 +1200,11 @@ Usage:
csvtk uniq [flags]
Flags:
-f, --fields string select these fields as the key. e.g -f 1,2 or -f columnA,columnB (default "1")
-f, --fields string select these fields as keys. e.g -f 1,2 or -f columnA,columnB (default "1")
-F, --fuzzy-fields using fuzzy fields, e.g., -F -f "*name" or -F -f "id123*"
-h, --help help for uniq
-i, --ignore-case ignore case
-n, --keep-n int keep at most N records for a key (default 1)
```

Expand Down Expand Up @@ -1228,6 +1239,27 @@ Examples:
Ken
Robert

- keep top 2 items for every group.

$ cat testdata/players.csv
gender,id,name
male,1,A
male,2,B
male,3,C
female,11,a
female,12,b
female,13,c
female,14,d

$ cat testdata/players.csv \
| csvtk sort -k gender:N -k id:nr \
| csvtk uniq -f gender -n 2
gender,id,name
female,14,d
female,13,c
male,3,C
male,2,B
## freq

Usage
Expand Down

0 comments on commit ee864e3

Please sign in to comment.