X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=csv_ripper;h=8ae35e9e38ec8ecdd819048f708bae7e69ee1e12;hp=bf787ffacedea7394885660a6e230800606c5c2e;hb=76574ae0d301dd1441181e47540c3e274caf4609;hpb=6c25f0626b026e59b9051c31d3eddfb6105f3c56 diff --git a/csv_ripper b/csv_ripper index bf787ff..8ae35e9 100755 --- a/csv_ripper +++ b/csv_ripper @@ -14,15 +14,16 @@ use warnings; use Text::CSV; -my $csv = Text::CSV->new(); +my $csv = Text::CSV->new( {binary => 1}); open CSV, '<', shift or die "Can't open file $!\n"; while () { $csv->parse($_); + die "Bad data on line $.\n$_\n" if ($csv->error_diag); my @chunks = $csv->fields; my @out = (); - for (@ARGV) - { push @out, $chunks[$_]} + for my $chunk (@ARGV) + { push @out, $chunks[$chunk] } print join("\t", @out), "\n"; }