csv

command module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: MIT Imports: 8 Imported by: 0

README

csv CodeFactor Go

Play with csv file(s). The tool is based on Go's encoding/csv package.

Install

  • Install in GOBIN or ~/go/bin:
go get github.com/shmsr/csv
  • Install manually:
go build

Usage

Usage of csv:
  -clrf
    	(Writer) If CRLF (crlf) is true, then use \r\n as the line terminator.
  -debug
    	(Writer) Debug field parsed by the CSV reader. Dumps to standard error (2).
  -f string
    	(Reader) Read the file to be be parsed.
  -fps
    	(Reader) If FieldsPerRecord (fps) is true, no check is made and records may have a variable number of fields.
  -fs string
    	(Reader) Specify index of required columns (separated by comma(s), 1 indexing). If empty, print all fields.
  -lq
    	(Reader) If LazyQuotes (lq) is true, a quote may appear in an unquoted field and a non-doubled quote may appear in a quoted field.
  -rd string
    	(Reader) Specify reader delimiter (single unicode character). (default ",")
  -tls
    	(Reader) If TrimLeadingSpace (tls) is true, leading white space in a field is ignored. This is done even if the field delimiter, Comma, is white space.
  -v	(Writer) Just validates the csv file and logs errors (if any).
  -wd string
    	(Writer) Specify writer delimiter (single unicode character). (default " ")

Example

./csv -f <filename> -rd ";" -wd "|"

The tool reads the file using the delimiter ; and prints the record(s) with delimiter | to stdout.

Documentation

Overview

The tool reads and writes comma-separated values (CSV) files based on the format described in RFC 4180. The behaviour of the tool can be configured using the flags. For usage of flags, use the "--h" or "--help" flag.

Jump to

Keyboard shortcuts

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