Skip to content

Commit

Permalink
v0.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Apr 11, 2016
1 parent f139602 commit 23b6974
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 11 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ to be continued...

## Examples

**Attention**

1. The CSV parser requires all the lines have same number of fields/columns.
Even lines with spaces will cause error.
2. By default, csvtk think your files have header row, if not, use `-H`.
3. By default, lines starting with `#` will be ignored, if the header row
starts with `#`, please assign `-C` another rare symbol, e.g. `&`.
4. By default, csvtk handles CSV files, use `-t` for tab-delimited files.

Examples

1. Select fields/columns (`cut`)

- By index: `csvtk cut -f 1,2`
Expand Down
4 changes: 3 additions & 1 deletion csvtk/cmd/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ func (csvReader *CSVReader) Run() {
csvReader.Ch <- CSVRecordsChunk{id, chunkData[0:i], err}
break
}

if record == nil {
continue
}
chunkData[i] = record
i++
if i == csvReader.chunkSize {
Expand Down
14 changes: 12 additions & 2 deletions csvtk/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,22 @@ var RootCmd = &cobra.Command{
Short: "Another cross-platform, efficient and practical CSV/TSV toolkit",
Long: `Another cross-platform, efficient and practical CSV/TSV toolkit
Version: 0.2.3
Version: 0.2.4
Author: Wei Shen <[email protected]>
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.
2. By default, csvtk think your files have header row, if not, use "-H".
3. By default, lines starting with '#' will be ignored, if the header row
starts with '#', please assign "-C" another rare symbol, e.g. '$'.
4. By default, csvtk handles CSV files, use "-t" for tab-delimited files.
`,
}

Expand All @@ -60,7 +69,8 @@ func init() {
RootCmd.PersistentFlags().StringP("delimiter", "d", ",", `delimiting character of the input CSV file`)
RootCmd.PersistentFlags().StringP("out-delimiter", "D", ",", `delimiting character of the input CSV file`)
// RootCmd.PersistentFlags().StringP("quote-char", "q", `"`, `character used to quote strings in the input CSV file`)
RootCmd.PersistentFlags().StringP("comment-char", "C", `#`, `commment character for start of line in the input CSV file`)
RootCmd.PersistentFlags().StringP("comment-char", "C", `#`, "lines starting with commment-character will be ignored. "+
`if your header row starts with '#', please assign "-C" another rare symbol, e.g. '$'`)
RootCmd.PersistentFlags().BoolP("lazy-quotes", "l", false, `if given, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field`)

RootCmd.PersistentFlags().BoolP("tabs", "t", false, `specifies that the input CSV file is delimited with tabs. Overrides "-d"`)
Expand Down
9 changes: 6 additions & 3 deletions doc/docs/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

## Current Version

- [csvtk v0.2.3](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.4](https://github.com/shenwei356/csvtk/releases/tag/v0.2.4)
- fix bug of handling comment lines
- add some notes before using csvtk

## Installation

Expand All @@ -32,6 +32,9 @@ You can also add the directory of the executable file to environment variable

## Previous Versions

- [csvtk v0.2.3](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)
- add flag `--keep-unmathed` to `join`
- [csvtk v0.2](https://github.com/shenwei356/csvtk/releases/tag/v0.2)
Expand Down
30 changes: 26 additions & 4 deletions doc/docs/usage.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
# Usage and Examples

## Before use

**Attention**

1. The CSV parser requires all the lines have same number of fields/columns.
Even lines with spaces will cause error.
2. By default, csvtk think your files have header row, if not, use `-H`.
3. By default, lines starting with `#` will be ignored, if the header row
starts with `#`, please assign `-C` another rare symbol, e.g. `&`.
4. By default, csvtk handles CSV files, use `-t` for tab-delimited files.

## csvkit

Usage

```
Another cross-platform, efficient and practical CSV/TSV toolkit
Version: 0.2.3
Version: 0.2.4
Author: Wei Shen <[email protected]>
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.
2. By default, csvtk think your files have header row, if not, use "-H".
3. By default, lines starting with '#' will be ignored, if the header row
starts with '#', please assign "-C" another rare symbol, e.g. '&'.
4. By default, csvtk handles CSV files, use "-t" for tab-delimited files.
Usage:
csvtk [command]
Expand All @@ -22,7 +42,7 @@ Available Commands:
cut select parts of fields
grep grep data by selected fields with patterns/regular expressions
inter intersection of multiple files
join join multiple CSV files by selected fields
join join multiple CSV files by selected fields
mutate create new column from selected fields by regular expression
rename rename column names
rename2 rename column names by regular expression
Expand All @@ -36,16 +56,18 @@ Available Commands:
Flags:
-c, --chunk-size int chunk size of CSV reader (default 50)
-C, --comment-char string commment character for start of line in the input CSV file (default "#")
-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 ",")
-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-cups int number of CPUs to use (default value depends on your computer) (default 4)
-j, --num-cpus int number of CPUs to use (default value depends on your computer) (default 4)
-D, --out-delimiter string delimiting character of the input CSV file (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.
```

## stat
Expand Down
2 changes: 1 addition & 1 deletion doc/site
Submodule site updated from 22be98 to d4d7e7

0 comments on commit 23b6974

Please sign in to comment.