Jump to content

procmail


jskywalker

Recommended Posts

i'm trying to filter some messages using procmail

 

when a message contains: 'Out: 401', i want to move it to a folder named 401

when a message contains: 'Out: 403', i want to move it to a folder named 403

etc..

 

Now i can make lines for every code possible (401, 403, ....., 450, 454)

But instead i'd like to maken 1 rule for 4xx and have the foldername based on the found code...

 

To achieve this, i tried to define a variable which should get the found errorcode

 

VAR=`formail -I "" | expand | sed -e 's/.*\(Out: \)\(4..\).*/\2/' -e '/^4/!d' | head -1`

 

:0 B

* ^Subject:.*errors

.folderwitherrors.${VAR}/

 

 

My question is, can above be done in a simpler way ? (and, if YES, how to do it.....)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.