Charles.Forsyth20060303-partialeea662d19 years agoHistory
66 lines · 1.3 KB · Text
RawDownload
.TH SH-CSV 1.SH NAMEcsv, getcsv \- parse ``comma-separated values''.SH SYNOPSIS.B load csv .B getcsv.I command.br.B ${csv.IB list }.br .SH DESCRIPTION.B Csvis a loadable module for.IR sh (1)that provides the facility to parse and generate``comma-separated value'' lists, a widely useddata exchange format.Data in this format is usually in the form of a table,each row of which contains one or more items,each separated by a comma.RB ( , ).Items that containa comma or a newline are surrounded with double-quotes(\f5"\fP).A double-quote within an item is represented by a pairof double-quotes.Two primitives are provided:.TP 10.B getcsv.B Getcsvworks similiarly to.B getlinesin.IR sh-std (1).It reads from the standard input, and for every line read,invokes.I commandwith.B $lineset to the items found on that line (one element per item)..B Getcsvrecognises the usual loop.B breakand.B continueexceptions..TP.B ${csv}.B Csvyields a single element containing all the items in.IR list ,comma-separated and quoted as necessary..SH SOURCE.B /appl/cmd/sh/csv.b.SH SEE ALSO.IR sh (1),.IR sh-std (1).SH BUGSEmpty lines are ambiguous:.B csvtreats an empty line as containing a single,empty element; there is thus no way ofrepresenting an line containing no elements at all.