=================================================================== RCS file: /cvs/pta/pta_import.pl,v retrieving revision 1.19 retrieving revision 1.21 diff -u -p -r1.19 -r1.21 --- pta/pta_import.pl 2020/11/22 01:48:36 1.19 +++ pta/pta_import.pl 2020/11/25 12:46:41 1.21 @@ -156,7 +156,7 @@ $banks{$account_name} or die "unknown accountname: $ac # Parse the configuration file. my $fn = "import_" . $account_name . ".txt"; open my $in, '<', $fn or die "$fn: $!"; -my ($csv_account, $delim, $header, $quote, @compiled); +my ($csv_account, $delim, $header, $quote, @compiled, @ignored); while (<$in>) { chomp; next if /^(?:#|$)/; @@ -181,6 +181,10 @@ while (<$in>) { $quote = $1; next; } + if (/^IGNORE\s+(.*)/) { + push @ignored, qr/$1/; + next; + } $delim or die "no DELIM line in $fn"; s/^(.*)$delim\s+(\d+)\s+(\S+)// or die "$fn import parse error: $line"; @@ -194,9 +198,15 @@ close $in; $csv_account or die "no ACCOUNT line in $fn"; # Parse the CSV file from the bank. -while (<>) { +if (@ARGV) { + open STDIN, '<', $ARGV[0] or die "$ARGV[0]: $!"; +} +LINE: while () { chomp; next if (/^$/); + foreach my $ignore (@ignored) { + next LINE if /$ignore/; + } my $line = $_; if ($header) { $line eq $header