LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-10-2003, 11:50 PM   #1
drand
LQ Newbie
 
Registered: Jun 2003
Location: Moscow, Russia
Posts: 4

Rep: Reputation: 0
procmailrc - substitute certain words to another.


i need substitute certain words in From: or To: or Body to another by .procmailrc
like..
From: bla <some@la.com>, joe <fuzzy@some.com>, other <some@some.com>
Just substitute "fuzzy@some.com" by "myfirend@some.com"
 
Old 07-11-2003, 12:25 AM   #2
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 457

Rep: Reputation: 41
Basically you can feed it through a pipe with sed (or awk, but I am better with sed. The following recipe may not work for all of the cases you are interested in, but :

:0 fwh
* ^From.*some.*com
|sed s/fuzzy@some.com/myfirend@some.com/g

This will just pass the mail along for further operation, with myfirend@some.com (did you mean myfriend? :-) substituted for fuzzy@some.com.

If you want joe <fuzzy@some.com> to go to joe@some.com (just a thought), try the following:

:0 fwh
* ^From.*joe.*some.com
|sed -e s/\ \<fuzzy//g -e s/\>//g

You need the backslashes for spaces, redirects (<,>) and of course other special characters.

Good luck, Chris
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
.procmailrc jayakrishnan Linux - Networking 0 11-19-2005 02:13 AM
Procmailrc file how many do I Need ?? wylie1001 Linux - Software 2 09-07-2005 07:20 PM
procmailrc davidsrsb Slackware 3 06-15-2005 11:07 AM
procmailrc filter for alias skyfly Linux - Security 1 05-19-2005 04:48 AM
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 07:48 PM


All times are GMT -5. The time now is 12:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration