-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmatcher.pl
More file actions
executable file
·39 lines (32 loc) · 997 Bytes
/
Copy pathmatcher.pl
File metadata and controls
executable file
·39 lines (32 loc) · 997 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
#print "Opening $ARGV[0] for parsing....\n";
$incstr = "^.*Start.*";
$decstr = "^.*Stop.*";
$endstr = "^.*End.*";
open (OUTFILE, ">matched.out");
print OUTFILE "Matcher on $ARGV[0] for \n Start=$incstr \n Stop=$decstr \n End=$endstr \n ";
print "FileMatch for \n Start=$incstr \n Stop=$decstr \n End=$endstr \n";
print OUTFILE "------------------------------------------------------------\n";
$count = 0;
open (MYFILE, $ARGV[0]);
while (<MYFILE>) {
if(/$endstr/){
print OUTFILE "E($count) - $_";
last;
}
elsif(/$incstr/){
$count++;
print OUTFILE "+($count)$_";
}
elsif(/$decstr/){
$count--;
print OUTFILE "-($count)$_";
}
else{
#don't care about this one
}
}
print "\n\nFinal count = $count\n\n";
print OUTFILE "\n\nFinal count = $count\n\n";
close (MYFILE);
close (OUTFILE);