Skip to content

Commit

Permalink
v0.3.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Jul 1, 2016
1 parent 2d2e6e2 commit b06dd98
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 24 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Another cross-platform, efficient, practical and pretty CSV/TSV toolkit
Yes, you could just use spreadsheet softwares like MS excel to
do most of the job.

Howerver it's all by clicking and typing, which is **not
automatically and time-consuming to repeate**, especially when we want to
However it's all by clicking and typing, which is **not
automatically and time-consuming to repeat**, especially when we want to
apply similar operations with different datasets or purposes.

`csvtk` is **convenient for rapid investigation
and also easy to integrated into analysis pipelines**.
It could save you much time of writting scripts.
It could save you much time of writing scripts.

Hope it be helpful to you.

Expand Down Expand Up @@ -92,7 +92,7 @@ You can add the directory of the executable file to environment variable
For Go developer, just one command:

go get -u github.com/shenwei356/csvtk/csvtk

## Compared to `csvkit`

[csvkit](http://csvkit.readthedocs.org/en/540/)
Expand All @@ -114,7 +114,7 @@ Similar tools:

- [csvkit](http://csvkit.readthedocs.org/en/540/) - A suite of utilities for converting to and working with CSV, the king of tabular file formats. http://csvkit.rtfd.org/
- [xsv](https://github.com/BurntSushi/xsv) - A fast CSV toolkit written in Rust.
- [miller](https://github.com/johnkerl/miller) - Miller is like sed, awk, cut, join, and sort for
- [miller](https://github.com/johnkerl/miller) - Miller is like sed, awk, cut, join, and sort for
name-indexed data such as CSV and tabular JSON http://johnkerl.org/miller
- [tsv-utils-dlang](https://github.com/eBay/tsv-utils-dlang) - Command line utilities for tab-separated value files written in the D programming language.

Expand Down Expand Up @@ -157,7 +157,7 @@ Examples
1 4 20 1 8 5 3.16
2 4 1,015 2 1,000 253.75 497.51
3 4 13 0 6 3.25 2.5

1. Select fields/columns (`cut`)

- By index: `csvtk cut -f 1,2`
Expand Down
6 changes: 3 additions & 3 deletions csvtk/cmd/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
)

// VERSION of csvtk
var VERSION = "0.3.5.1"
const VERSION = "0.3.5.2"

func checkError(err error) {
if err != nil {
Expand Down Expand Up @@ -297,15 +297,15 @@ func parseFields(cmd *cobra.Command,
negativeFields = true
} else {
if negativeFields {
checkError(fmt.Errorf(`filed should not fixed with positive and negative fields`))
checkError(fmt.Errorf(`filed should not mixed with positive and negative fields`))
}
}
}
// 2 pass check
if negativeFields {
for _, f := range fields {
if f > 0 {
checkError(fmt.Errorf(`filed should not fixed with positive and negative fields`))
checkError(fmt.Errorf(`filed should not mixed with positive and negative fields`))
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion csvtk/cmd/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Multiple keys supported, but the orders are ignored.

fuzzyFields := getFlagBool(cmd, "fuzzy-fields")
keepUnmatched := getFlagBool(cmd, "keep-unmatched")
fill := getFlagString(cmd, "fill")

outfh, err := xopen.Wopen(config.OutFile)
checkError(err)
Expand Down Expand Up @@ -137,7 +138,7 @@ Multiple keys supported, but the orders are ignored.
} else {
if keepUnmatched {
for i := 1; i <= len(data[0])-len(fieldsMap); i++ {
record = append(record, "")
record = append(record, fill)
}
Data2 = append(Data2, record)
}
Expand Down Expand Up @@ -165,4 +166,5 @@ func init() {
joinCmd.Flags().BoolP("ignore-case", "i", false, `ignore case`)
joinCmd.Flags().BoolP("fuzzy-fields", "F", false, `using fuzzy fileds, e.g. *name or id123*`)
joinCmd.Flags().BoolP("keep-unmatched", "k", false, `keep unmatched data of the first file`)
joinCmd.Flags().StringP("fill", "", "", `fill content for unmatched data`)
}
12 changes: 7 additions & 5 deletions csvtk/cmd/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/brentp/xopen"
"github.com/spf13/cobra"

"github.com/tatsushid/go-prettytable"
"github.com/dustin/go-humanize"
"github.com/tatsushid/go-prettytable"
)

// statCmd represents the stat command
Expand All @@ -46,10 +46,9 @@ var statCmd = &cobra.Command{
checkError(err)
defer outfh.Close()


tbl, err := prettytable.NewTable([]prettytable.Column{
{Header: "file"},
{Header: "num_cols", AlignRight: true},
{Header: "file"},
{Header: "num_cols", AlignRight: true},
{Header: "num_rows", AlignRight: true}}...)
checkError(err)
tbl.Separator = " "
Expand All @@ -73,9 +72,12 @@ var statCmd = &cobra.Command{
once = false
}
}
if !config.NoHeaderRow {
if numRows > 0 && !config.NoHeaderRow {
numRows--
}
if numRows < 0 {
numRows = 0
}
tbl.AddRow(
file,
humanize.Comma(int64(numCols)),
Expand Down
7 changes: 5 additions & 2 deletions doc/docs/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

## Current Version

- [csvtk v0.3.5.1](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.2](https://github.com/shenwei356/csvtk/releases/tag/v0.3.6)
- add flag `--fill` for `csvtk join`, so we can fill the unmatched data
- fix typo

## Installation

Expand Down Expand Up @@ -38,6 +39,8 @@ For Go developer, just one command:

## Previous Versions

- [csvtk v0.3.5.1](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)
- fix minor bug of `csv2md`
- add subcommand `version` which could check for update
Expand Down
12 changes: 7 additions & 5 deletions doc/docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

## Forewords

Another cross-platform, efficient, practical and pretty CSV/TSV toolkit

Yes, you could just use spreadsheet softwares like MS excel to
do most of the job.

Howerver it's all by clicking and typing, which is **not
automatically and time-consuming to repeate**, especially when we want to
However it's all by clicking and typing, which is **not
automatically and time-consuming to repeat**, especially when we want to
apply similar operations with different datasets or purposes.

`csvtk` is **convenient for rapid investigation
and also easy to integrated into analysis pipelines**.
It could save you much time of writting scripts.
It could save you much time of writing scripts.

Hope it be helpful for you.
Hope it be helpful to you.

## Analyzing OTU table

Expand Down Expand Up @@ -107,7 +109,7 @@ What's a mess. Let's make it prettier!
B.2 .13 .55 .16 .01 .03
B.3 .22 .41 .29 .01 .02

1. Rename first column
1. Rename name of the first column

$ csvtk rename -f 1 -n "sample" otu_table.gAB.t.csv -o otu_table.gAB.t.r.csv

Expand Down
3 changes: 2 additions & 1 deletion 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.5
Version: 0.3.5.2
Author: Wei Shen <[email protected]>
Expand Down Expand Up @@ -473,6 +473,7 @@ Usage:
Flags:
-f, --fields string Semicolon seperated key fields of all files, if given one, we think all the files have the same key columns. e.g -f 1;2 or -f A,B;C,D or -f id (default "1")
--fill string fill content for unmatched data
-F, --fuzzy-fields using fuzzy fileds, e.g. *name or id123*
-i, --ignore-case ignore case
-k, --keep-unmatched keep unmatched data of the first file
Expand Down
2 changes: 1 addition & 1 deletion doc/site
Submodule site updated from 994d3f to 74ee35

0 comments on commit b06dd98

Please sign in to comment.