CSV

Generic CSV lens collection

Author: Raphael Pinson raphael.nosp@m..pinson@camptoc.nosp@m.amp.com

Summary
CSVGeneric CSV lens collection
Referencehttps://tools.ietf.org/html/rfc4180
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration files
ExamplesThe <Test_CSV> file contains various examples and tests.
Augeas Lenses
eol
comment
entryAn entry of fields, quoted or not
lnsThe generic lens, taking the separator as a parameter
lnsThe comma-separated value lens
lns_semicolA semicolon-separated value lens

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

Examples

The <Test_CSV> file contains various examples and tests.

Caveats

No support for files without an ending CRLF

Augeas Lenses

eol

let eol = Util.del_str "\n"

comment

let comment = Util.comment | [ del /#[ \t]*\r?\n/ "#\n" ]

entry

let entry (sep_str:string) = let field = [ seq "field" . store (/[^"#\r\n]/ - sep_str)* ] | [ seq "field" . store /("[^"#]*")+/ ] in let sep = Util.del_str sep_str in [ seq "entry" . counter "field" . Build.opt_list field sep . eol ]

An entry of fields, quoted or not

lns

let lns_generic (sep:string) = (comment | entry sep)*

The generic lens, taking the separator as a parameter

lns

let lns = lns_generic ","

The comma-separated value lens

lns_semicol

let lns_semicol = lns_generic ";"

A semicolon-separated value lens

let eol = Util.del_str "\n"
let comment = Util.comment | [ del /#[ \t]*\r?\n/ "#\n" ]
let entry (sep_str:string) = let field = [ seq "field" . store (/[^"#\r\n]/ - sep_str)* ] | [ seq "field" . store /("[^"#]*")+/ ] in let sep = Util.del_str sep_str in [ seq "entry" . counter "field" . Build.opt_list field sep . eol ]
An entry of fields, quoted or not
let lns_generic (sep:string) = (comment | entry sep)*
The generic lens, taking the separator as a parameter
let lns_semicol = lns_generic ";"
A semicolon-separated value lens
Close