[R-1051] Searching mail list archives

Mark Richards mark.richards at massmicro.com
Mon Mar 31 12:10:40 EDT 2014


I'm looking for any reference in the archives to "motor", as there may 
be some helpful information on repairing a module's drive motor.

To go through each and every month and then read every message in order 
that I might find "motor" in any of the messages, I wrote a script to do 
the heavy lifting.

It creates a single (large) text file from which with a good editor you 
may search and find what you need.

It will run on a linux box having php and wget installed.

Not for the newbie.. and please, pardon my code.  It's a quickie.

Later, I suppose it could be made available on a host and with a simple 
UI might display the text being searched.

/K1MGY



<?php

$sroot="http://mailman.qth.net/pipermail/r-1051";
$aMonths=array();
$aMonths[]="January";
$aMonths[]="February";
$aMonths[]="March";
$aMonths[]="April";
$aMonths[]="May";
$aMonths[]="June";
$aMonths[]="July";
$aMonths[]="August";
$aMonths[]="September";
$aMonths[]="October";
$aMonths[]="November";
$aMonths[]="December";

$nMonth=0;

$filepath = "mergedfiles.txt";
$out = fopen($filepath, "w");

for ($nYear=2002; $nYear<2015;++$nYear)
{
     for ($nMonth=0;$nMonth<12;++$nMonth)
     {
         $cGetPath=$sroot.'/'.$nYear.'-'.$aMonths[$nMonth].".txt.gz";
         echo $cGetPath."\n";
         system("wget -q '".$cGetPath."'");
         $cFn=$nYear."-".$aMonths[$nMonth].".txt.gz";
         system("gzip -d ".$cFn);
         $cFn=$nYear."-".$aMonths[$nMonth].".txt";
         echo "Getting contents of [".$cFn."]\n";
         $line = file($cFn);
         if ($line)
         {
             foreach ($line as $cLn)
             {
                 if (!fwrite($out,$cLn))
                 {
                     echo "error writing \n";
                     exit;
                 }
             }
         }
     }
}

fclose($out);

echo "See ".$filepath;



-- 




More information about the R-1051 mailing list