in reply to tab delimited extraction, formatting the output
#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $file = "fielded.txt"; my $csv = Text::CSV->new({sep_char => "\t"}); # create a new objec +t open my $fh, "<", $file or die "Unable to open $file: $!"; while (my $data_ref = $csv->getline($fh)) { my @data = @{$data_ref}; if ($data[0] eq "'EOU'.") { # End of record code } elsif ($data[2] eq "u") { print "\n$data[3]" } elsif ($data[2] eq "p") { print "$data[3]\n" } else { #die "Unexpected line format encountered, $file, @data"; } } close $fh;
Update: I should point out you've made great strides since block extraction - congratulations.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: tab delimited extraction, formatting the output
by zzgulu (Novice) on Feb 09, 2009 at 21:21 UTC | |
by kennethk (Abbot) on Feb 09, 2009 at 22:04 UTC | |
by Anonymous Monk on Feb 09, 2009 at 23:20 UTC | |
by kennethk (Abbot) on Feb 09, 2009 at 23:28 UTC | |
by zzgulu (Novice) on Feb 12, 2009 at 15:47 UTC | |
|