This page is orphaned, abandoned, and unmaintained.
No further updates will be made to this page, and accuracy is neither expected nor guaranteed. It is left in place solely for historical interest.
This page describes some of the common questions received, or anticipated, about the sift utility.
This page suppliments the supplied README file included within the distribution.
Each line in the rulefile you pass to sift is assumed to contain a list of space-separated tokens. These tokens are the rules and their arguments.
If you wish to pass an argument to a primitive which contains a space (" ") you should replace it with a # character. For example to copy all new messages from the INBOX to the folder "TO READ" you would use this:
folder:inbox status:new copy:TO#READ(If you wish to use a literal "#" in an argument you may replace it with "##".)
The Selection Primitives
As of version 0.5 the following selection primitives exist:
- folder:arg
This selects the folder "arg", and selects each available message.
- [!]body:pattern
This reduces the currently selected messages to those containing the specified pattern, or in the case of !body those which do not match the pattern.
- [!]subject:pattern
This reduces the currently selected messages to those containing the specified pattern in their "Subject:" header, or in the case of !subject those which do not match the pattern.
- [!]cc:pattern
This reduces the currently selected messages to those containing the specified pattern in their "Cc:" header, or in the case of !cc those which do not match that pattern.
- [!]to:pattern
This reduces the currently selected messages to those containing the specified pattern in their "To:" header, or in the case of !to those which do not match the pattern.
- [!]from:pattern
This reduces the currently selected messages to those containing the specified pattern in their "From:" header, or in the case of !from those which do not match the pattern.
- status:{new|old}
This reduces the currently selected messages to those which are either "New" or have been read.
When a folder is selected each message in that folder is marked as "selected". The selection primitives allow you to reduce the selected messages to only those which match your criterion.
The Operating Primitives
As of version 0.5 of sift the following operations may be carried out.
Each operation applies to all currently selected messages.
- copy:dest
Copy the message(s) to the specified IMAP folder.
- delete
Delete the message(s).
- dump
Dump a brief overview of the message(s).
- exec:program
Run the program specified, passing it the body of each message in turn.
- execonce:program
Run the program specified - regardless of how many messages are currently selected. No arguments, or input, is passed to the program.
- mark:{read|unread}
Change the state of the message(s).
- move:dest
Move the message(s) to the specified IMAP folder.
If you have a problem with a collection of rules you should invoke sift with the --verbose flag. This will cause the tool to output diagnostic information about its actions.