From ee8e4e6a9b047dbf7c15b24bb32051b74a4fc2cc Mon Sep 17 00:00:00 2001 From: Shawn Boyette Date: Tue, 20 Jan 2009 21:22:29 +0000 Subject: [PATCH] first checkin --- csv_extractor | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100755 csv_extractor diff --git a/csv_extractor b/csv_extractor new file mode 100755 index 0000000..b1c2a2e --- /dev/null +++ b/csv_extractor @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +# TODO +# +# * add getopt support +# * use tag generator to expand list of wanted fields? + +use strict; +use warnings; + +use Text::CSV; + +my $csv = Text::CSV->new({escape_char => "+", allow_loose_quotes => 1}); + +open CSV, '<', shift or die "Can't open file $!\n"; + +while () { + $csv->parse($_); + my @chunks = $csv->fields; + my @out = (); + for (@ARGV) + { push @out, $chunks[$_]} + print join("\t", @out), "\n"; +} -- 1.7.2.5