summaryrefslogtreecommitdiffstats
path: root/df
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-09-24 11:22:17 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-09-24 11:22:37 +0100
commitf8a96c659616b4e88bb2e6af8e23deea3bd96f0c (patch)
tree99f232984ef24d4df876604d9a75eab3e81d3d0a /df
parent6a14f1c2502f58ff7bed8cb451f95a83f5ee920a (diff)
downloadlibguestfs-f8a96c659616b4e88bb2e6af8e23deea3bd96f0c.tar.gz
libguestfs-f8a96c659616b4e88bb2e6af8e23deea3bd96f0c.tar.xz
libguestfs-f8a96c659616b4e88bb2e6af8e23deea3bd96f0c.zip
virt-df: Add note about parsing CSV.
Diffstat (limited to 'df')
-rwxr-xr-xdf/virt-df29
1 files changed, 27 insertions, 2 deletions
diff --git a/df/virt-df b/df/virt-df
index 21ba7917..78eb25c9 100755
--- a/df/virt-df
+++ b/df/virt-df
@@ -107,8 +107,9 @@ my $csv;
=item B<--csv>
-Write out the results in CSV format (comma-separated values).
-This format can be imported easily into databases and spreadsheets.
+Write out the results in CSV format (comma-separated values). This
+format can be imported easily into databases and spreadsheets, but
+read L</NOTE ABOUT CSV FORMAT> below.
=cut
@@ -309,6 +310,30 @@ sub human_size
}
}
+=head1 NOTE ABOUT CSV FORMAT
+
+Comma-separated values (CSV) is a deceptive format. It I<seems> like
+it should be easy to parse, but it is definitely not easy to parse.
+
+Myth: Just split fields at commas. Reality: This does I<not> work
+reliably. This example has two columns:
+
+ "foo,bar",baz
+
+Myth: Read the file one line at a time. Reality: This does I<not>
+work reliably. This example has one row:
+
+ "foo
+ bar",baz
+
+For shell scripts, use C<csvtool> (L<http://merjis.com/developers/csv>
+also packaged in major Linux distributions).
+
+For other languages, use a CSV processing library (eg. C<Text::CSV>
+for Perl or Python's built-in csv library).
+
+Most spreadsheets and databases can import CSV directly.
+
=head1 SEE ALSO
L<guestfs(3)>,