Skip to content

Commit

Permalink
v0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Nov 7, 2016
1 parent 35236d8 commit b650a41
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 23 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ and also easy to integrated into analysis pipelines**.

[Download Page](https://github.com/shenwei356/csvtk/releases)

`csvtk` is implemented in [Golang](https://golang.org/) programming language,
`csvtk` is implemented in [Go](https://golang.org/) programming language,
executable binary files **for most popular operating systems** are freely available
in [release](https://github.com/shenwei356/csvtk/releases) page.

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

// VERSION of csvtk
const VERSION = "0.3.9"
const VERSION = "0.4.1"

func checkError(err error) {
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion csvtk/cmd/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Special repalcement symbols:
checkError(err)

kvFile := getFlagString(cmd, "kv-file")
keepKey := getFlagBool(cmd, "keep-key")

var replaceWithNR bool
if reNR.MatchString(replacement) {
Expand Down Expand Up @@ -265,8 +266,10 @@ Special repalcement symbols:
}
if _, ok = kvs[k]; ok {
r = reKV.ReplaceAllString(r, kvs[k])
} else {
} else if keepKey {
r = reKV.ReplaceAllString(r, found[1])
} else {
r = reKV.ReplaceAllString(r, "")
}
}
}
Expand Down Expand Up @@ -296,6 +299,7 @@ func init() {
replaceCmd.Flags().BoolP("ignore-case", "i", false, "ignore case")
replaceCmd.Flags().StringP("kv-file", "k", "",
`tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)`)
replaceCmd.Flags().BoolP("keep-key", "K", false, "keep the key as value when no value found for the key")
}

var reNR = regexp.MustCompile(`\{(NR|nr)\}`)
Expand Down
64 changes: 51 additions & 13 deletions doc/docs/download.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
# Download

`csvtk` is implemented in [Golang](https://golang.org/) programming language,
`csvtk` is implemented in [Go](https://golang.org/) programming language,
executable binary files **for most popular operating system** are freely available
in [release](https://github.com/shenwei356/csvtk/releases) page.

## Current Version

[csvtk v0.3.9](https://github.com/shenwei356/csvtk/releases/tag/v0.3.9)
[csvtk v0.4.1](https://github.com/shenwei356/csvtk/releases/tag/v0.4.1)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.4.1/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.4.1)

- fix bug: header row incomplete in `csvtk sort` result
- Nothing changed. Just fix the links due to inappropriate deployment of v0.4.0

Links:

- **Linux**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_linux_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_linux_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_arm.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_linux_arm.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_arm64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_linux_arm64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_386.tar.gz)
[csvtk_linux_386.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_amd64.tar.gz)
[csvtk_linux_amd64.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_arm.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_arm.tar.gz)
[csvtk_linux_arm.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_arm.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_linux_arm64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_arm64.tar.gz)
[csvtk_linux_arm64.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_linux_arm64.tar.gz)
- **Mac OS X**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_darwin_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_darwin_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_darwin_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_darwin_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_darwin_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_darwin_386.tar.gz)
[csvtk_darwin_386.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_darwin_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_darwin_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_darwin_amd64.tar.gz)
[csvtk_darwin_amd64.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_darwin_amd64.tar.gz)
- **Windows**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_windows_386.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_windows_386.exe.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_windows_amd64.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.3.9/csvtk_windows_amd64.exe.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_windows_386.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_windows_386.exe.tar.gz)
[csvtk_windows_386.exe.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_windows_386.exe.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/csvtk/latest/csvtk_windows_amd64.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_windows_amd64.exe.tar.gz)
[csvtk_windows_amd64.exe.tar.gz](https://github.com/shenwei356/csvtk/releases/download/v0.4.0/csvtk_windows_amd64.exe.tar.gz)

## Installation

[Download Page](https://github.com/shenwei356/csvtk/releases)

`csvtk` is implemented in [Golang](https://golang.org/) programming language,
`csvtk` is implemented in [Go](https://golang.org/) programming language,
executable binary files **for most popular operating systems** are freely available
in [release](https://github.com/shenwei356/csvtk/releases) page.

Expand Down Expand Up @@ -56,67 +65,96 @@ For Go developer, just one command:

## Previous Versions

- [csvtk v0.4.0](https://github.com/shenwei356/csvtk/releases/tag/v0.4.0)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.4.0/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.4.0)
- add flag for `csvtk replace`: `-K` (`--keep-key`) keep the key as value when
no value found for the key. This is open in default in previous versions.
- [csvtk v0.3.9](https://github.com/shenwei356/csvtk/releases/tag/v0.3.9)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.9/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.4.0)
- fix bug: header row incomplete in `csvtk sort` result
- [csvtk v0.3.8.1](https://github.com/shenwei356/csvtk/releases/tag/v0.3.8.1)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.8.1/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.8.1)
- fix bug of flag parsing library [pflag](https://github.com/spf13/pflag),
[detail](https://github.com/spf13/pflag/pull/98).
The bug affected the `csvtk grep -r -p`, when value of `-p` contain "[" and "]"
at the beginning or end, they are wrongly parsed.
- [csvtk v0.3.8](https://github.com/shenwei356/csvtk/releases/tag/v0.3.8)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.8/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.8)
- new feature: `csvtk cut` supports ordered fields output. e.g., `csvtk cut -f 2,1`
outputs the 2nd column in front of 1th column.
- new commands: `csvtk plot` can plot three types of plots by subcommands:
- `csvtk plot hist`: histogram
- `csvtk plot box`: boxplot
- `csvtk plot line`: line plot and scatter plot
- [csvtk v0.3.7](https://github.com/shenwei356/csvtk/releases/tag/v0.3.7)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.7/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.7)
- fix a serious bug of using negative field of column name, e.g. `-f "-id"`
- [csvtk v0.3.6](https://github.com/shenwei356/csvtk/releases/tag/v0.3.6)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.6/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.6)
- `csvtk replace` support replacement symbols `{nr}` (record number)
and `{kv}` (corresponding value of the key ($1) by key-value file)
- [csvtk v0.3.5.2](https://github.com/shenwei356/csvtk/releases/tag/v0.3.6)
- [csvtk v0.3.5.2](https://github.com/shenwei356/csvtk/releases/tag/v0.5.2)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.5.2/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.5.2)
- add flag `--fill` for `csvtk join`, so we can fill the unmatched data
- fix typo
- [csvtk v0.3.5.1](https://github.com/shenwei356/csvtk/releases/tag/v0.3.5.1)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.5.1/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.5.1)
- fix minor bug of reading lines ending with `\r\n` from a dependency package
- [csvtk v0.3.5](https://github.com/shenwei356/csvtk/releases/tag/v0.3.5)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.5/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.5)
- fix minor bug of `csv2md`
- add subcommand `version` which could check for update
- [csvtk v0.3.4](https://github.com/shenwei356/csvtk/releases/tag/v0.3.4)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.4/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.4)
- fix bug of `csvtk replace` that head row should not be edited.
- [csvtk v0.3.3](https://github.com/shenwei356/csvtk/releases/tag/v0.3.3)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.3/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.3)
- fix bug of `csvtk grep -t -P`
- [csvtk v0.3.2](https://github.com/shenwei356/csvtk/releases/tag/v0.3.2)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.2/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.2)
- fix bug of `inter`
- [csvtk v0.3.1](https://github.com/shenwei356/csvtk/releases/tag/v0.3.1)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3.1/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3.1)
- add support of search multiple fields for `grep`
- [csvtk v0.3](https://github.com/shenwei356/csvtk/releases/tag/v0.3)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.3/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.3)
- add subcommand `csv2md`
- [csvtk v0.2.9](https://github.com/shenwei356/csvtk/releases/tag/v0.2.9)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.9/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.9)
- add more flags to subcommand `pretty`
- fix bug of `csvtk cut -n`
- add subcommand `filter`
- [csvtk v0.2.8](https://github.com/shenwei356/csvtk/releases/tag/v0.2.8)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.8/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.8)
- add subcommand `pretty` -- convert CSV to readable aligned table
- [csvtk v0.2.7](https://github.com/shenwei356/csvtk/releases/tag/v0.2.7)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.7/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.7)
- fix highlight failing in windows
- [csvtk v0.2.6](https://github.com/shenwei356/csvtk/releases/tag/v0.2.6)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.6/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.6)
- fix one error message of `grep`
- highlight matched fields in result of `grep`
- [csvtk v0.2.5](https://github.com/shenwei356/csvtk/releases/tag/v0.2.5)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.5/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.5)
- fix bug of `stat` that failed to considerate files with header row
- add subcommand `stat2` - summary of selected number fields
- make the output of `stat` prettier
- [csvtk v0.2.4](https://github.com/shenwei356/csvtk/releases/tag/v0.2.4)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.4/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.4)
- fix bug of handling comment lines
- add some notes before using csvtk
- [csvtk v0.2.3](https://github.com/shenwei356/csvtk/releases/tag/v0.2.3)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.3/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.3)
- add flag `--colnames` to `cut`
- flag `-f` (`--fields`) of `join` supports single value now
- [csvtk v0.2.2](https://github.com/shenwei356/csvtk/releases/tag/v0.2.2)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.2/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.2)
- add flag `--keep-unmathed` to `join`
- [csvtk v0.2](https://github.com/shenwei356/csvtk/releases/tag/v0.2)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2)
- finish almost functions
- [csvtk v0.2.1](https://github.com/shenwei356/csvtk/releases/tag/v0.2.1)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/csvtk/v0.2.1/total.svg)](https://github.com/shenwei356/csvtk/releases/tag/v0.2.1)
- fix bug of `mutate`


Expand Down
9 changes: 3 additions & 6 deletions doc/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Usage
```
Another cross-platform, efficient and practical CSV/TSV toolkit
Version: 0.3.8
Version: 0.4.1
Author: Wei Shen <[email protected]>
Expand Down Expand Up @@ -518,11 +518,6 @@ Usage:
csvtk rename2 [flags]
Flags:
-f, --fields string select only these fields. e.g -f 1,2 or -f columnA,columnB
-F, --fuzzy-fields using fuzzy fileds, e.g. *name or id123*
-i, --ignore-case ignore case
-p, --pattern string search regular expression
-r, --replacement string renamement. supporting capture variables. e.g. $1 represents the text of the first submatch. ATTENTION: use SINGLE quote NOT double quotes in *nix OS or use the \ escape character.
```

Expand Down Expand Up @@ -563,10 +558,12 @@ Flags:
-f, --fields string select only these fields. e.g -f 1,2 or -f columnA,columnB (default "1")
-F, --fuzzy-fields using fuzzy fileds, e.g. *name or id123*
-i, --ignore-case ignore case
-K, --keep-key keep the key as value when no value found for the key
-k, --kv-file string tab-delimited key-value file for replacing key with value when using "{kv}" in -r (--replacement)
-p, --pattern string search regular expression
-r, --replacement string replacement. supporting capture variables. e.g. $1 represents the text of the first submatch. ATTENTION: use SINGLE quote NOT double quotes in *nix OS or use the \ escape character.
```

Examples
Expand Down
2 changes: 1 addition & 1 deletion doc/site
Submodule site updated from 215657 to 5e8afa

0 comments on commit b650a41

Please sign in to comment.