I get around 100 emails a day from the servers that I manage. Procmail dumps them all into the same mbox, which is the way I like it. I want to create a macro that creates a limit based on the host of the sender of the current email in the index - in my case its the name of the server that emailed me. This way, I could quickly see all the emails from each server.

So, if the current email iss from root@server.something.com i'd like a limit like:
~L server

The best I can come with is something like:

macro index <esc>s "<enter-command>unset wait_key\n<pipe-message>formail -x From:|sed -e 's/\w\+\@\(\w\+\)\..*/\1/'>/tmp/muttlimit\n<enter-command>set wait_key\n<limit>~L `cat /tmp/muttlimit`<enter>" "Change limit"

But this doesn't work.

Any thoughts?