I am looking for a way to select multiple messages in Mutt.
For example, selecting the first and the last message would select a whole block of messages. I'd also like to select a subject using a regular expression.
Then, I want to run a command on the selected messages, e.g., save them to a file.
Best Answer
You need to run the
tag-pattern
command. The default for that isT
(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 bysave-message
(s), and it will prompt you for a mailbox name. This command marks the saved messages to be deleted; there is also thecopy-message
command (C
, i.e. Shift+c) to copy without marking for deletion.