Skip to content

Separate a CSV file into smaller ones based on percentage

License

Notifications You must be signed in to change notification settings

jacobseth/csvpart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card

CSVPart

Golang CSV file splitter that allows you to partition by percentages

Installation

As this tool is written in golang, you will need to download and install golang.

To build and install, use the go get tool:

go get github.com/jacobseth/csvpart

Basic usage

CSVpart will read a file from a provided filename, and partition it into a number of files based on the provided percentages.

NAME:
   CSVPart - Separate a CSV file into smaller ones based on percentage

USAGE:
   csvpart [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --filename value  name of file to be partitioned
   --headers value   number of header lines to duplicate (default: 0)
   --whole           Assume provided percentage is a part of a whole, and fill the remainder (default: false)
   --help, -h        show help (default: false)

Resultant files are named based on the index of their respective percentages, in the following format: %d_some_data.csv.

Examples

Split a CSV file 60% - 40%

csvpart --headers 1 --filename some_data.csv 60 40

Split a CSV file 60% - ~40% using --whole flag

csvpart --headers 1 --filename some_data.csv --whole 60

Pull/Feature requests welcome! :)

About

Separate a CSV file into smaller ones based on percentage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages