totsv

Current version: 1.1.0

A simple utility for cleaning up csv style files by converting them to tab separated values. These are usually easier to handle than regular csv files. An escape character can be supplied to handle fields containing the separator.

Usage

totsv [-s SEPARATOR] [-e ESCAPE] FILE1 FILE2 ...
	-s SEPARATOR    Set the separating character. Default: ','
	-e ESCAPE       Set the escape character. Default not set.
	-u              Unset the escape character.

Example

Consider the following csv:

a,"bb,ccc",dddd

Without specifying the escape:

a	"bb	ccc"	dddd

Note that the " charater is part of the second and third field.

Specifying the escape as " gives the following:

a	bb,ccc	dddd

Example 2

You can chain multiple files after another and set a different escape character between them.

totsv data -e'"' data -u data -s'"' data

With the dataset data

a,"bb,ccc",dddd

This parses the data file 4 times in the following order:

  1. without escape character and , as separator
  2. with " as the escape character and , as separator
  3. without escape character and , as separator
  4. with separator "

This can be used to combine heterogenous datasets.

Releases

The current version can be fetched via git: git://git.lemen.xyz/totsv.git