Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to select multiple messages in Mutt.

For example select the first and the last message would select a whole block of messages. Possible also to select by regexp for subject.

I want then run a command on the selected messages, i.e. save them to a file.

share|improve this question
up vote 21 down vote accepted

You need to run the tag-pattern command. The default for that is T (Shift+t). You can then give it a regular expression. By default this will match message subjects.

If you need to select a range of messages by number, you can provide the ~m [MIN]-[MAX] pattern to tag-pattern. There are many other options I've found useful over the years, and you can see a complete list in the “Advanced Usage - Patterns” section of the manual.

You can also use t to tag or untag the highlighted message, to fine-tune the selection.

Then you can run tag-prefix (;) followed by save-message (s), and it will prompt you for a mailbox name. This command marks the saved messages to be deleted; there is also the copy-message command (C, i.e. Shift+c) to copy without marking for deletion.

share|improve this answer
    
That's it, thanks! – user55518 Feb 15 '14 at 16:42
2  
to select all: T then dot (.) – tutuDajuju Sep 1 '15 at 6:33

Extending @Scott McClung correct answer.

If you want to apply mutt commands by default to all selected (tagged) messages without using tag-prefix (bounded to ; by default), you can set auto_tag variable

add to your .muttrc line:

set auto_tag = true
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.