Advertisement
Advertisement
| 09.22.2008 at 11:04AM PDT, ID: 23752294 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: |
#!/usr/bin/perl -w
use strict;
# little script for thyros, Expert-Exchange.com Q_22833778.html
# see http://www.experts-exchange.com/Q_22833778.html
open TAGS, "tags_to_match.txt" or die("ERROR: tags file 'tags_to_match.txt' not found");
my $all_tags = do { local $/; <TAGS> };
my @tags = split(/\n/,$all_tags);
my $merge_cat_path_count = 0;
$/ = "</item_data>";
while (<>) {
s/\|//g;
die("ERROR: pipeline '|' character found in data!") if /\|/;
foreach my $tag (@tags) {
my $tmpTag = $tag; # work on a copy
my $count = 1;
$count = $1 if $tmpTag =~ s/(\d+)$//;
print "$1" if m!(?:<$tmpTag>([^<]*)</$tmpTag>.*?){$count}!ms; # do not set /g modifier!
print "|";
}
print "\n";
}
|