Help for Pine - The Aggregate Command
You are in Home > Miscellaneous > The Aggregate Command


Sometimes one would like to remove more than one message from a folder, and sometimes pressing "D" to delete such messages is too slow, or not the best way to get rid of these messages. Aggregate operations allow you to simplify these type of operations, so that a command can be applied over a large quantity of messages.

What is necessary to understand is that applying an aggregate operation is a two step process: First you must select the group of messages over which you want to apply the same command and second you must apply the command that you want over the already selected messages.

Aggregate operations can only be done in the index screen.

One thing to remember is that every time you select messages, you can do it based in one and only one criteria (say sender of the message must be a specific person, or a message was sent yesterday, etc). If you want to use more than one criteria for searching (e.g. messages from your boss about overtime), you must first select messages based on one criteria (say messages from your boss) and then use the select command again to either narrow or broaden your last search (in this case narrow your search for messages that contain the word overtime in their subject).

Relevant Configuration Options

The Basic Process

There are two parts of this process. One is the selection of messages which is done with the ";" command, and the other one is the command that is going to be applied over the selected messages which is done using the "A" command. Even though this page describes all commands that can be issued, you can find them all by reading the menu in the bottom of the screen at any time. In any case, here are some examples. The final RETURN that must be pressed to execute the command is not listed. The select ";" and apply "A" commands appear in boldface.

Understanding the Process

The process that must be followed in order to apply the same command over a set of messages is quite standard. It has two parts. First you choose the messages over which you want to apply the same command (say delete all these messages), and once you have selected those messages, you apply a command on all of them (say delete).

To start the process, you must press the ; command. There are two possibilities:

  1. If there are no messages already selected, you will see a menu in the bottom of the screen. Read it. It will give you several possibilities summarized in the following table:
    AThis command selects all messages.
    C This command selects the message on which the cursor is.
    This command is not desirable if you enabled auto-zoom-after-select. In this case the index will be zoomed and you will only see the message you just selected. If you do not wish to have Pine zoom after selecting the message over which the cursor is positioned, press : instead, while you are in the index screen and do not go through this menu.
    N To select messages based on their number.
    This command can search based on ranges. For example, in order to select the 50 first messages of the folder you would enter 1-50. Ranges, or simply message numbers can be added to the pattern if you separate them using a comma. For example, 1-50, 75, 77, 79, 103-106 would select the 50 first messages, the 75th, 77th and 79th message, plus messages 103 to 106.
    There is an old tradition in unix of using "." (a dot), and $ (a peso sign) to denote the current and last message of a folder. Pine gives you an error message if you enter these characters. In case you do not remember the number of the current message, or the number of the last message, look at the top of the screen, to the right it will say something like Message 23 of 37, indicating the numbers of the current message (23) and the last message (37).
    D To select messages based on date.
    Once you select this option you will see a prompt which will say something like this:
    Select messages which were SENT SINCE (inclusive) [24-Aug-2004]:
    There are several items in the menu, which when pressed change the content of the prompt. For example, the date that appears in the prompt can be changed by pressing the ^P or ^N keys, to change this date to the previous or next day, respectively, so pressing ^P would change the date, in the above example, to 23-Aug-2004 and ^N would change it to 25-Aug-2004.
    Every time you press ^N or ^P the date changes only one day. This means that if you wanted to select all messages sent in the last two years, you would have to press the ^P key more than 700 times!. You can either enter the date of two years ago in the prompt directly 24-Aug-2002 or if you put the cursor over a message that was sent 2 years ago (which will hopefully be easier to find) and use the ^X key in the menu to change the date that appears in the prompt to the date of the message over which the cursor is positioned.
    There is a key ^W which allows you to change a property that the message must have with respect to the date (e.g. as above 24-Aug-2004) already selected. If you press this toggle several times you will see the words SENT and ARRIVED 3 times.
    The word SENT refers to the date as it appears on the Date: header of the message in the folder. This header is set according to the clock in the computer that is running the e-mail program the person sending the message is using, and therefore this could be incorrect. Most people have set it correctly, though. Notice that because of change in time zones, you may want to search for messages in the future. In fact a message sent at 1 AM on Eastern Standard Time is in the future for someone in the Pacific Standard Time, for whom the time is 10 PM of the previous day.
    The word ARRIVED refers to the time the message was saved in the folder that you are reading and can differ from the SENT date considerably. The time a message arrived to a folder is normally close to the sent date if that message goes to your INBOX, but it may not be close to the sent date, if you take, say 2 days to save that message to your saved-messages folder. In that case the arrival date (in the saved-messages folder) will be the date that you saved it to that folder, which is completely different to the sent date, or to the date of arrival to your INBOX. In other words, the arrival date is not inherent to the message but to what has happened to the message since it was sent.
    Each of the options SENT and ARRIVED have three suboptions: SINCE, BEFORE and ON, with obvious meanings. For example ARRIVED SINCE means messages that were saved to that folder since the date that appears in prompt.
    Once you have adjusted the prompt to mean the type of search that you want done, simply press RETURN to execute it.
    TTo select messages based on text contained in headers and/or body.
    STo select messages based on status (meaning flag information, e.g. messages with the answered flag, etc)
    ZTo select messages based on their size in Kilobytes.
    KTo select messages based on Keyword flagging.

  2. If there are some message already selected, the menu in the bottom of the screen will look different:
    AThis command UNselects all messages.
    C This command UNselects the message on which the cursor is. A better way to do this is pressing : (the colon key) in the index menu, and not going through this menu.
    B (Broaden)Use this command to add more messages to the list of selected messages. For example, you could select all messages from your boss in the first selected and pressing B you could select messages from his/her secretary.
    N (Narrow)To select messages only from the list of selected messages. For example, you could have selected messages from your boss in a first pass, then using the N command you can narrow your selection to messages about a specific project.
    F (Flip)This selects all messages that were not selected and unselects all selected messages. For example, to select all messages that are not from your boss, you would select all messages from your boss first, then press F.

    After you have selected any of these options, the menu will be the same as in part 1 above.

Sample Commands

Below you can find a few examples of how to use the select command.
  1. To select all messages from Lisa use
    ; T F Lisa
  2. To select all messages from Lisa that have arrived in the last week (assuming today is 24-Aug-2004) use
    ;T F Lisa ; N D ^W ^W ^W 17-Aug-2004
    You could also doit backwards selecting messages that arrived in the last seven days and then narrowing the search to those that were sent by Lisa. as: ; D ^W ^W ^W 17-Aug-2004 ; N T F Lisa
  3. To select all messages from Lisa and Andrés received in the last week (assuming today is 24-Aug-2004) use
    ; D ^W ^W ^W 17-Aug-2004 ; N T F Lisa ; B T F Andrés
  4. To find the last message sent by Lisa we first find all messages from Lisa and finally sort by arrival. The last message is the one we are looking for, so we use the command
    ; T F Lisa $ A ^W ^V