mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2026-02-20 03:05:19 +00:00
[svn r8003] fix fucking qm script AGAIN
This commit is contained in:
@@ -92,7 +92,8 @@ while (<CSV>) {
|
|||||||
if (!$ref) { $ref = ""; }
|
if (!$ref) { $ref = ""; }
|
||||||
if (!$grade) { $grade = ""; }
|
if (!$grade) { $grade = ""; }
|
||||||
if (!$desc) { $desc = ""; }
|
if (!$desc) { $desc = ""; }
|
||||||
# hacked in by DL, as was acting weirdly due to uninitialized variables
|
if (!$area) { $area = ""; }
|
||||||
|
print "number $number, grade $grade, area $area, desc $desc, ref $ref, station $station, completion $completion\n";
|
||||||
|
|
||||||
if (($completion ne "") and ($ref ne ""))
|
if (($completion ne "") and ($ref ne ""))
|
||||||
{
|
{
|
||||||
@@ -177,25 +178,13 @@ print "\nInformation: Done\n";
|
|||||||
|
|
||||||
# Parse the CSV file
|
# Parse the CSV file
|
||||||
sub parse_csv {
|
sub parse_csv {
|
||||||
my $line = $_[0];
|
my @fields=split /\t/;
|
||||||
my @parsedline = ();
|
my @unquoted=();
|
||||||
my $field = '';
|
foreach $_ (@fields) {
|
||||||
|
$_ =~ s/\"//g;
|
||||||
while ($line =~ m{ \G(?:^|,)
|
push (@unquoted, $_);
|
||||||
(?: "((?> [^"]*) (?> "" [^"]*)*)" | ([^",]*)) }gx) {
|
|
||||||
if ($2) {
|
|
||||||
$field = $2;
|
|
||||||
} elsif ($1) {
|
|
||||||
$field = $1;
|
|
||||||
$field =~ s/""/"/g;
|
|
||||||
} else {
|
|
||||||
$field = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
push(@parsedline, $field);
|
|
||||||
}
|
}
|
||||||
|
return @unquoted;
|
||||||
return(@parsedline);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|||||||
Reference in New Issue
Block a user