GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - PostScripton/splinter: Splinter - CLI utility for splitting CSV files into parts by rows

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
cmd/splinter
cmd/splinter
 
 
internal/splitter
internal/splitter
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
go.mod
go.mod
 
 

Repository files navigation

Splinter

Splinter is a CLI utility written in Go for splitting large CSV files into parts by a specified number of rows. Each part preserves the original CSV header and column order.

Installation

go build -o ./bin/splinter ./cmd/splinter

Or install globally:

go install ./cmd/splinter

After installation, the binary will be placed in $GOPATH/bin/splinter (or $HOME/go/bin/splinter if GOPATH is not set).

To use it, make sure $GOPATH/bin (or $HOME/go/bin) is in your PATH. You can add it to your shell profile:

# For bash/zsh
export PATH=$PATH:$(go env GOPATH)/bin

Or call it directly with the full path: $(go env GOPATH)/bin/splinter

Usage

splinter -f <file> -n <row_count> -o <output_directory> [-s <separator>]

Flags

  • -f, --file (required) - Path to the CSV file to split
  • -n, --rows (required) - Number of rows per split file (excluding header)
  • -o, --output (required) - Directory to save the split parts
  • -s, --separator (optional) - CSV field separator (default: ,)
  • -h, --help - Show usage help

Examples

Split file data.csv into parts of 1000 rows each:

splinter -f data.csv -n 1000 -o output/

Using long flags:

splinter --file large.csv --rows 500 --output parts/

Split a semicolon-separated file:

splinter -f data.csv -n 1000 -o output/ -s ";"

Show help:

splinter -h
# or
splinter --help
# or simply
splinter

Output File Format

When splitting a file example.csv, the following files will be created:

  • example_1.csv
  • example_2.csv
  • example_3.csv
  • etc.

Each file contains:

  • Original CSV header
  • Specified number of data rows (or fewer for the last file)
  • Preserved column order

Project Structure

splinter/
├── cmd/
│   └── splinter/
│       └── main.go          # Entry point, argument parsing
├── internal/
│   └── splitter/
│       └── splitter.go      # CSV splitting business logic
├── go.mod
└── README.md

Requirements

  • Go 1.21 or higher

Dependencies

The project uses only the Go standard library:

  • flag - for CLI flag handling
  • encoding/csv - for CSV file operations
  • os, path/filepath - for filesystem operations

About

Splinter - CLI utility for splitting CSV files into parts by rows

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.