I am searching through about 20 log files approx 200 meg each. The following code is the sub whith which I actually do the searching and output the text.
sub search_file
{
my ($filename) = @_;
open (TMPFILE, "$filename") or die("unable to open $filename: $!\n
+"),br;
print h3("$_\n");
while (<TMPFILE>)
{
if ( m/^....($MM1|$MM2|$MM3|$MM4|$MM5|$MM6)/)
{
s/($SEARCH|$SEARCH1|$SEARCH2)/<font color=\"#0000ff\"><b>$
+1<\/b><\/font>/o;
print "$_\n",br;
}
}
close (TMPFILE);
}
Basically the $MM1 - $MM6 are dates that Im searching for and $SEARCH-$SEARCH2 are Items Im searching for within those dates...
This is working fine. What Im looking to do - since this app takes somewhere between 5 and 10 minutes to finish searching all the files is to save the results and re-search on the data that has already been returned. I thought about initially dumping the search into a text file and doing the sub search ($SEARCH-$SEARCH2) within that. The trouble is there may be several people running this at once, and I dont want to create a lot fo text files on the server that I need to delete later.
How would I go about saving a sessions worth of data for possible more than one user, and forget about the saved session data once the browser session is closed? I just hate having to resubmit new search criteria, and wait several minutes for my new output, when I already have the data sitting in front of me.
Ted
--
"Men have become the tools of their tools."
--Henry David Thoreau
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.