Magic Pipes
Documentation
Login

mpcsv-write [-R record-sep-char] [-T|-D field-sep-char] [-q|-Q field-quote-char] [-c|-C char-quote-char]

Reads sexprs from standard input, which must be lists, and writes them to standard output as comma-separted-values values terminated by a newline. If -T is specified, then it writes out tab-separated values instead. If -D is specified, an arbitrary field seaprator is used.

If -R is specified, then the record terminator can be overridden from newline to any character.

If a field contains record or field separators, or any backslash or quote characters, then the field will be written enclosed in quote (") characters. If -Q is specified, than an arbitrary character can be used instead of ".

Any backslash or quote characters within the field will be prefixed with a backslash (\). If -C is specified, then an arbitrary character can be used instead of \.

If -q is specified, field quoting is disabled. Any record terminator, field separator, or backslash characters in field values will be prefixed with backslash (or character specified with -C).

If -c is specified, then character prefix quoting is disabled. Any quote characters within fields will be doubled, so Hello "world" is written as "Hello ""world""".

You can't specify both -q and -c.

Examples

mpcsv-read < test.csv | mpmap reverse | mpcsv-write > out.csv