Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- my $basedir = "/Users/chipzz/Interface";
- our %string_locations;
- while (<>)
- {
- chomp;
- $string_locations{$_} = {};
- }
- my $regex_string = join "|", keys %string_locations;
- my $re = qr/\b($regex_string)\b/;
- sub ggg
- {
- my ($base, $sub) = @_;
- my $dir = "$base/$sub";
- opendir (my $dh, $dir) || die "Can't open $dir\n";
- while (readdir $dh)
- {
- next if (/^\.\.?$/);
- ggg($dir, $_) if (-d "$dir/$_");
- if (/\.(xml|lua)$/)
- {
- open FILE, "$dir/$_";
- foreach my $match (grep $_ =~ $re, (<FILE>))
- {
- $match =~ $re;
- @{$string_locations{$1}}{$subdir} = 1;
- }
- close FILE;
- }
- }
- closedir $dh;
- }
- foreach our $subdir (qw(FrameXML GlueXML SharedXML AddOns))
- {
- ggg($basedir, $subdir);
- }
- foreach my $string (keys %string_locations)
- {
- print "$string\t";
- print join "\t", sort keys %{$string_locations{$string}};
- print "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement