[oak perl] Signatures.....

M. Lewis cajun at cajuninc.com
Mon Dec 2 02:43:42 CST 2002


When I posted the script to rotate your signatures and wrote the part
about building a file of your favorite signatures, some of you might
have an easy way to gather signatures for this file.

I belong to several mailing lists. A good portion of those mailing
lists, the posters have signatures. Some of them are even cool.

Those running Linux have an easy way to gather these signatures. Here's
a short script I wrote to parse my 245MB maillist file (it's really only
one list) and generate a smaller file with just the signature portion,
if it exists, of each message.

#!/usr/bin/perl -w

use strict;

my $infile="./Red-Hat List";
my $outfile="./signatures";
my $sigfound=0;

open(INFILE,"$infile") or die "Can't open $infile :$!";
open(OUTFILE,">$outfile") or die "Sorry, but I can't write to $outfile
:$!";

while(<INFILE>){
  if (/^--\s+$/){
    $sigfound++;
    next;
    }

    if ($sigfound){
      if (/^\s+PLEASE read the Re/){
        $sigfound=0;
        next;
      }
      if ($sigfound<5){
        print OUTFILE;
        $sigfound++;
        if ($sigfound==5){
          print OUTFILE "-"x70;
          print OUTFILE "\n";
          $sigfound=0;
        }
      }
    }
}

-- 
  
  If a program is useful, it must be changed.
 12:35am  up 1 day, 23 min,  5 users,  load average: 0.10, 0.08, 0.02
  
  Linux Registered User #241685  http://counter.li.org




More information about the Oakland mailing list