M
mmittiga17
Need help folks.
I have a csv file that has some fields containing "," as part of the
field and not a delimiter. These fields are double quoted.
What I need to do is read each line, if the value in field 22 = X dont
print
$line. How can I get the value of each line's field 22, when split
does not work on csv files that have quoted fields?
example: "Potsdam, NY"
This one is driving me crazy.
I have only gotten about this far:
use Text:
arseWords;
while (@ARGV) {
$file=shift (@ARGV);
open (IN,"$file") unless ($file =~ /\.Z/);
while (defined($line = <IN>)) {
@fields =quotewords(',', 0, $line);
print "@fields[22]\n";
}
}
I have also tried the regex for csv files from Mastering Regex.
One thought was use a hash...
Any help or suggestions would be appreciated.
Thanks
I have a csv file that has some fields containing "," as part of the
field and not a delimiter. These fields are double quoted.
What I need to do is read each line, if the value in field 22 = X dont
$line. How can I get the value of each line's field 22, when split
does not work on csv files that have quoted fields?
example: "Potsdam, NY"
This one is driving me crazy.
I have only gotten about this far:
use Text:
while (@ARGV) {
$file=shift (@ARGV);
open (IN,"$file") unless ($file =~ /\.Z/);
while (defined($line = <IN>)) {
@fields =quotewords(',', 0, $line);
print "@fields[22]\n";
}
}
I have also tried the regex for csv files from Mastering Regex.
One thought was use a hash...
Any help or suggestions would be appreciated.
Thanks