procmail
[Top] [All Lists]

Re: Replacing Characters in Variables

2000-09-21 22:18:59
Florian asked,

| Is it possile to replace characters in variables, for example:

| Now, before I use this variable like this:
| 
|  | formail -i "From: niemand(_at_)nirgends(_dot_)de" -I "Subject: 
Wichtig:$MATCH"
| 
| , I want to strip all "<" and ">" in $MATCH.

| How can I achieve this ???


  # first pair of brackets enclose space, tab, less than, greater than
  # second pair of brackets enclose caret, space, tab, less than, greater than
  :0i
  * ^Subject:[  <>]*\/[^        <>].*
  { SUBJECT=$MATCH }
  :0E
  { SUBJECT="missing, blank, or empty" }

  :0
  * SUBJECT ?? [<>]
  SUBJECT=| echo "$SUBJECT" | tr -d '<>'

  :0fhw # since we now know $SUBJECT won't begin with a space
  | formail -i "From: niemand(_at_)nirgends(_dot_)de" -I "Subject: Wichtig: 
$SUBJECT"

It could be done totally within procmail by using a recursive INCLUDERC, but
it is probably more efficient to fork a shell and tr.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>