GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: Programs   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index

3.8 readmsg — Extract Messages from a Folder

The readmsg utility extracts messages from a mailbox according to the criteria specified in the command line. These criteria are:

  1. A lone ‘*’ means “select all messages in the mailbox”.
  2. A list of message numbers may be specified. Values of ‘0’ and ‘$’ in the list both mean the last message in the mailbox. For example:
    readmsg 1 3 0
    

    extracts three messages from the folder: the first, the third, and the last.

  3. Finally, the selection may be some text to match. This will select a mail message which exactly matches the specified text. For example,
    readmsg staff meeting
    

    extracts the message which contains the words ‘staff meeting’. Note that it will not match a message containing ‘Staff Meeting’ – the matching is case sensitive by default. This can changed using the -i (--ignorecase) option. Two more options are provided to control the matching algorithm: the -g (--glob) option instructs readmsg to treat arguments as shell globbing patterns and the -r (--regex) option instructs it to treat them as POSIX extended regular expressions. Needless to say, when using any of the two latter options, you should pay attention to escape the matching pattern to prevent it from being interpreted by the shell. E.g.:

    readmsg --regex 'staff.*meeting'
    

Unless requested otherwise, only the first message that matches the pattern is printed.

At least one command line argument or one informational option must be present in readmsg invocation. Informational options are: --help (-?), --usage, and --version (-V).

GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: Programs   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index