Fernando Vilas wrote:
> On Friday 28 September 2007 11:17:09 Ronnie Gilkey wrote:
>
>> I don't think that sed/sh is the answer. I'd use Perl. Basically you
>> can write a smart regex to detect an equal sign followed by a hex code.
>> The regex should capture the hex code. From the trapped code, you could
>> use the chr() function to replace the value (0x0a = newline):
>>
>>
>
> Perl is probably a better solution, but I know sed better, so I wrote it
> using
> that. The chr() function would be really be useful, though. I'll have to
> look into changing my script to Perl, but for something quick and dirty, it
> solves the problem today.
>
> Now the trick of integrating it into procmail as a filter, and still allowing
> other rules to process the mail later.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> General mailing list
> General at brlug.net
> http://mail.brlug.net/mailman/listinfo/general_brlug.net
I'm not very good with procmail, but I know that procmail will allow you
to pass the input through a pipe, so you could set a filter that matches
all mails to pipe to perl. With that the perl "one-liner" is handy (-n
for treating the code as being inside while (<>)):
perl -ne "if ($_ =~ m/(=[0-9a-fA-F]{2})/) { $text = $1; $replace =
chr($text); $_ =~ s/$text/$replace/g; }
It's not perfect, but I think you understand where I'm going with this.
Ronnie
--
Puryear Information Technology, LLC
Baton Rouge, LA * 225-706-8414
http://www.puryear-it.com
Visit http://www.puryear-it.com/pubs/ebooks/ to download your free
copies of:
"Best Practices for Managing Linux and UNIX Servers"
"Spam Fighting and Email Security in the 21st Century"
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://mail.brlug.net/pipermail/general_brlug.net/attachments/20070928/39f42de2/attachment.html