mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-07-31 08:38:12 -05:00
windows, and sundry other things. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3329 57a11ea4-9604-0410-9ed3-97b8803252fd
39 lines
1.1 KiB
Perl
Executable File
39 lines
1.1 KiB
Perl
Executable File
#! /usr/bin/perl
|
|
|
|
use DB_File;
|
|
|
|
tie %contents, 'DB_File', $ARGV[0];
|
|
|
|
shift @ARGV;
|
|
|
|
foreach my $file (@ARGV) {
|
|
my %filewords;
|
|
|
|
open(HELPFILE, $file) or die "Bad help file $file specified.\n";
|
|
my $size = (stat($file))[7];
|
|
my $data;
|
|
read HELPFILE,$data,$size;
|
|
$data =~ s/<[^>]*>/ /gs; # get rid of HTML tags
|
|
$data =~ tr/\",();&<>!$*/ /; # get rid of extra punct
|
|
$data =~ tr/[A-Z]/[a-z]/; # lowercase everything
|
|
$data =~ tr/ \012\011/ /s; # crunch whitespace
|
|
$data =~ s/[\.,\'\":\;\+|-]+ / /gs; # get rid of terminal punct
|
|
$data =~ s/ [.,\'\":;+|-]+/ /gs; # get rid of initial punct
|
|
$data =~ s/ [^ ] / /gs; # remove 1-letter words
|
|
$data =~ s/ [^ ][^ ] / /gs; # remove 2-letter words
|
|
$data =~ tr/ \012\011/ /s; # crunch whitespace again
|
|
my @words = split(' ', $data);
|
|
@words = sort(@words);
|
|
foreach my $w (@words) {
|
|
$filewords{$w} = ' ';
|
|
}
|
|
foreach my $w (keys(%filewords)) {
|
|
my $flist = $contents{$w};
|
|
$contents{$w} = "$flist$file\012";
|
|
}
|
|
}
|
|
|
|
untie %contents;
|
|
|
|
|