[libvirt] [PATCHv4 1/2] virsh: add new --details option to pool-list

Richard W.M. Jones rjones at redhat.com
Thu Jul 1 15:11:13 UTC 2010


On Fri, Jul 02, 2010 at 12:59:36AM +1000, Justin Clift wrote:
> On 07/01/2010 08:42 PM, Richard W.M. Jones wrote:
> <snip>
>> CSV is a good format, but beware the many ways to shoot yourself in
>> the foot.  I recommend using my program "csvtool" (in Fedora/Debian)
>> which can fully and safely parse CSV output from shell scripts, or use
>> a library (eg. Text::CSV for Perl, or csv for Python).  More about
>> this subject here:
>>
>>    http://libguestfs.org/virt-df.1.html#note_about_csv_format
>
> Is the correct workaround here being able to specify the field and  
> record delimiters?  To (for example) use "|" or "\t" instead of ",".

The CSV format is rather underspecified as it is.  csvtool was written
based on what a certain popular spreadsheet can do, plus much folk
wisdom.  Changing the delimiter doesn't particularly help.

Basically you have to be able to parse CSV files like this one from
the csvtool test suite:

----------------------------------------------------------------------
"This is a test
with commas,,,,,

and carriage returns
and "0",a second field,a third field
a fourth field on a new line
----------------------------------------------------------------------

(That CSV file has two rows and three columns)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://et.redhat.com/~rjones/libguestfs/
See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html




More information about the libvir-list mailing list