Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Perl one-liner

Expand Messages
  • Bill Landry
    ... Thanks Robert, that does indeed work. ... However, someone else sent me this modification to what I already had, and it seems to be working just great:
    Message 1 of 3 , May 19, 2009
    • 0 Attachment
      Robert Lee Binkley wrote:

      > You are very close, but what you want is something like:
      >
      > perl -e 'while ( $ARGV[0] =~ /([a-fA-F0-9]{2})|(\{[^}]*\})|(\([^\)]*\))/g )
      > {print ( defined $2 ? $2 : defined $3 ? $3 : chr(hex $1))};print qq[\n]'
      > 582d4d61696c65723a205048504d61696c6572205b76657273696f6e20312e37335d{-3}582d
      > 4d61696c65723a207068706c6973742076322e31302e34{-3}
      >
      > prints out
      >
      > -Mailer: PHPMailer [version 1.73]{-3}X-Mailer: phplist v2.10.4{-3}

      Thanks Robert, that does indeed work.

      > There are probably better ways ( I know there are ), but this does what
      > you want!!

      However, someone else sent me this modification to what I already had,
      and it seems to be working just great:

      perl -pe 's/(\{[^}]*\}|\([^)]*\)|\*)|(.)/defined $1 ? $1 :
      sprintf("%02lx", ord $2)/eg'

      And I can pipe my data stings into it "|". But thanks again, your
      suggestion is very much appreciated!

      Bill
    Your message has been successfully submitted and would be delivered to recipients shortly.