37
GitHub - johnweldon/sortcsv: Sort CSV files
source link: https://github.com/johnweldon/sortcsv
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
sortcsv
Tool to sort csv files by named columns.
Deprecated
Example
The example script shows how to use it to sort with multiple sub-sort columns.
$ ./example_sort
Sort 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
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK