On Wed, 30 May 2007 11:10:00 +0530, Laxminarayan G Kamath A
<[EMAIL PROTECTED]> wrote:
> The attached file is what I have
> come up to.. but it still takes more
... Had forgotten to attach the file..
--
Cheers,
Laxminarayan G Kamath A
e-mail: [EMAIL PROTECTED]
Work URL: http://deeproot.in
#!/usr/bin/perl
my $readline, $line;
$readline = "";
$line = "";
@records = ();
@fields = ();
while (<STDIN>) {
$readline = $_;
if (($line eq "") && ($readline =~ /^\s*$/)) {
next;
}
$line = $line . $readline;
@fields=();
if ( $line =~ /(^[^\"]*$)|(^([^\"]*(\"[^\"]*\")[^\"]*)+$)/s ) {
chomp($line);
print "$line\n";
print "---------------\n";
push (@records, $line);
$last = "";
$_ = $line;
while (/\B\"([^\"]*)\"\B|([^\,\"]*)/g) {
$res = "$1$2";
push (@fields, $res);
if ($res ne "") {
/\B\"([^\"]*)\"\B|([^\,\"]*)/g;
}
}
map({print "$_\n............\n"} @fields);
print "===============\n";
$line = "";
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/