GertMT has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use diagnostics; use Data::Table; use DBI; open( OUT, ">blah.csv" ) or die "cant open out $!"; open( OUT_no_fl, ">blah_no_first_line.csv" ) or die "cant open out $!" +; my $dbh = DBI->connect( 'dbi:AnyData(RaiseError=>1):' or die $DBI::err +str ); $dbh->func( 'test_me', 'CSV', 'big_data_file.csv', { sep_char => ',', eol => "\015", col_names => 'ID,Seizoen,Brand,Model,Color,Size,Material,Stock' }, 'ad_catalog' ); my $select_from_data = Data::Table::fromSQL( $dbh, "SELECT ID, Size, Brand, Color FROM test_me WHERE Stock>'0'" ); $dbh->disconnect(); $select_from_data = $select_from_data->match_pattern( '$_->[1] =~ /^\d+$/ && $_->[1] >= 18 && $_->[1] <= 41'); print OUT $select_from_data->csv; open( FH, "blah.csv" ) or die "$!\n"; readline(FH); #<-- read the first line effectively skipping it while (<FH>) { print OUT_no_fl $_; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Get output AnyData script without header or data_row
by jZed (Prior) on Dec 19, 2007 at 18:30 UTC | |
by GertMT (Hermit) on Dec 19, 2007 at 18:39 UTC | |
by jZed (Prior) on Dec 19, 2007 at 18:43 UTC | |
Re: Get output AnyData script without header or data_row
by jrsimmon (Hermit) on Dec 19, 2007 at 18:20 UTC | |
by GertMT (Hermit) on Dec 19, 2007 at 18:35 UTC |