csvsplit

command module
v0.0.0-...-57023cc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2014 License: MIT Imports: 7 Imported by: 0

README

csvsplit

Command csvsplit splits a .csv into multiple, smaller files.

Documentation

http://godoc.org/github.com/JeffPaine/csvsplit

Documentation

Overview

Command csvsplit splits a .csv into multiple, smaller files.

Resulting files will be saved as 1.csv, 2.csv, etc. in the currect directory, unless the -output flag is used.

Install

Requires Go to be installed first, https://golang.org/doc/install.

$ go get github.com/JeffPaine/csvsplit

Flags

Basic usage: csvsplit -records <number of records> <file>

-records

Number of records per file

-output

Output filename / path (optional)

-headers

Number of header lines in the input file to add to each ouput file (optional, default=0)

Examples

Split file.csv into files with 300 records a piece.

$ csvplit -records 300 file.csv

Accept csv data from stdin.

$ cat file.csv | csvsplit -records 20

Split file.csv into files with 40 records a piece and two header lines (preserved in all files).

$ csvplit -records 40 -headers 2 file.csv

You can use the -output flag to customize the resulting filenames. The below will generate custom_filename-001.csv, custom_filename-002.csv, etc..

$ csvsplit -records 20 -output custom_filename- file.csv

Split file.csv into files with 37 records a piece into the subfolder 'stuff'.

$ csvplit -records 37 -output stuff/ file.csv

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL