Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnweldon/sortcsv
Sort CSV files
https://github.com/johnweldon/sortcsv
command-line-tool csv go sort sort-csv-files
Last synced: 3 months ago
JSON representation
Sort CSV files
- Host: GitHub
- URL: https://github.com/johnweldon/sortcsv
- Owner: johnweldon
- License: mit
- Created: 2017-03-24T23:54:47.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-14T17:25:58.000Z (over 2 years ago)
- Last Synced: 2024-10-14T20:35:00.376Z (3 months ago)
- Topics: command-line-tool, csv, go, sort, sort-csv-files
- Language: Go
- Size: 154 KB
- Stars: 47
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sortcsv
Tool to sort csv files by named columns.
## NB
Deprecated
## Example
The [example](example_sort) script shows how to use it to sort with multiple sub-sort columns.
```shell
$ ./example_sortSort by Last, First, Email
--
First,Last,Email
Mary,Bunce,[email protected]
John,Doe,[email protected]
Mary,O'Henry,[email protected]
Mary,O'Henry,[email protected]
Adam,Van der Oos,[email protected]Sort by First, Last, Email
--
First,Last,Email
Adam,Van der Oos,[email protected]
John,Doe,[email protected]
Mary,Bunce,[email protected]
Mary,O'Henry,[email protected]
Mary,O'Henry,[email protected]
```## Installation
Requires Go 1.8+ because it uses the new [`sort.Slice`](https://golang.org/pkg/sort/#Slice) feature.
`go get jw4.us/sortcsv`
## Usage
`sortcsv sort`
```
NAME:
sortcsv sort -USAGE:
sortcsv sort [command options] [arguments...]OPTIONS:
--infile value, --in value, -i value Defaults to stdin (-) if not specified. (default: -)
--outfile value, --out value, -o value Defaults to stdout (-) if not specified. (default: -)
--sortby value, -s value Columns to sort by, repeat for sub-sort
--tab, -t Input is tab delimited, rather than comma delimited (default: false)
--help, -h show help (default: false)
```If `--infile` or `--outfile` are not specified they default to `stdin` and `stdout` respectively.
The `--sortby` flag can be specified repeatedly to add sub-sorting.