As requested, this is just a starting place based upon the information you've provided and testing is limited to exactly that shown in the output. You'll probably want to tweak the regex to better match your data.
In terms of performance, I tested it against 10 years worth of monthly files with 100 comments per file, which I think far exceeds your requirements, and it takes all of 6/100ths of a second. That's probably how long it would take to make a connection to a database.
#! perl -slw use strict; use Time::HiRes qw[ time ]; sub slurp { local( $/, @ARGV ) = ( -s( $_[0] ), $_[0] ); <>; } my $start = time; my $user = $ARGV[0] or die 'No user supplied'; my @matches; my $files = 0; while( glob 'hist/*.htm' ) { $files++; my $file = slurp $_; push @matches, $_ if $file =~ m[ <b>Comment\s+\d+</b><br>\n \Q$user\E ]mx; } printf "Searched $files files in %g seconds\n", time() - $start; die "No match found for user $user" unless @matches; print "User $user found in files:\n", join "\n", @matches; __END__ P:\test>522029 Buk Searched 133 files in 0.0694289 seconds No match found for user Buk at P:\test\522029.pl line 26, <> line 133. P:\test>522029 Doug Searched 133 files in 0.069006 seconds User Doug found in files: hist/h0511.htm hist/h0601.htm P:\test>522029 "J H" Searched 133 files in 0.0696189 seconds User J H found in files: hist/h0511.htm hist/h0601.htm
In reply to Re: Search function for guestbook history?
by BrowserUk
in thread Search function for guestbook history?
by JCHallgren
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |