> On Fri, Jan 26, 2001 at 11:06:44AM -0500, Warren Melnick wrote:
>
> Hi Warren Melnick,
>
> This was a very good tutorial.
> I was not the person asking but anyway thank you very much for that.
>
> I have a similar problem but a little bit different,
> and wonder if awk can be used for that too.
>
> I am presently trying to learn perl to do the job with
> as I think it will be useful for me later on.
>
> What I need to do is to add a footer in my outgoing email.
> It has to be placed at different places in the file depending whether it
> is in html format or in text/plain format.
> Please have a look at a cut from the email below.
>
> In simple terms:
>
> Find string  `boundary"`
> put string `----=_NextPart_001_004B_01C08570.D30AB6E0` into "$variable"
> find next "$variable"  # skip this one
> find next "$variable"  # skip this one
> replace "$variable" with xxxxxx+"$variable"
> write balance of file to outputfile.


I'm typing this up as I would write it.  It's not been tested, but perhaps
could give you a start.



open(INFILE, 'readfile') || die $!;
open(OUTFILE, '>writefile') || die $!;
my $variable;
my $count;
foreach $string (<INFILE>) {
    if ( $string =~ /boundary\"/ ) {
        $variable = '----=_NextPart_001_004B_01C08570.D30AB6E0';
    }
    if ( $variable ) {
        $count++;
        if ( $count == 3 ) {
            $string = 'xxxxxx' . $variable;
        }
    }
    print OUTFILE $string;
}
close INFILE;
close OUTFILE;



Clarence Donath
mrdo.com



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to