
newbie trying to parse one file into three
: I've got a text file with various records in it. Each record is on an
: individual line, and each record is comma delimited.
: I need to take this file, and put (let's say) fields one, four and seven
: of each record into a file. Likewise, I need to put fields two and five
: into another file, while fields three and six go into a third file.
: I've got a rough idea on what to do, but what Perl statements/code will
: best allow me to do so? I'd like to have a solid footing to go on before I
: start. Thanks for any and all help.
-------------------------------
#!/usr/bin/perl -w
open(FH147, ">147.db") || die "could not open '147.db' $!";
open(FH25, ">25.db") || die "could not open '25.db' $!";
open(FH36, ">36.db") || die "could not open '36.db' $!";
while (<DATA>) {
chomp;
Quote:
}
close(FH147);
close(FH25);
close(FH36);
__DATA__
one1,two1,three1,four1,five1,six1,seven1
one2,two2,three2,four2,five2,six2,seven2
one3,two3,three3,four3,five3,six3,seven3
one4,two4,three4,four4,five4,six4,seven4
-------------------------------
--
Tad McClellan SGML Consulting
Fort Worth, Texas