Spitting a Mailbox into separate files with formail

Vidol Loeung fedora.kh at undp.org
Fri Sep 23 02:38:00 UTC 2005


Thank you James for your response. Sorry for the incomplete posting. I tried
all your commands. They worked! Thanks again.

Vidol

----- Original Message ----- 
From: "James Wilkinson" <fedora at westexe.demon.co.uk>
To: "For users of Fedora Core releases" <fedora-list at redhat.com>
Sent: Thursday, September 22, 2005 7:11 PM
Subject: Re: Spitting a Mailbox into separate files with formail


> Vidol Loeung wrote:
> > A long time ago, I used to be able to split a mailbox into separate text
> > files with this command:
> >
> > cat $MAIL | formail -ds 'sh -c cat > msg.$FILENO'
> >
> > Now, when I tried it again on Fedora, it did not work.
> >
> > Could you please help me?
>
> May I suggest that you're more likely to get responses if you give us a
> bit more detail than "it didn't work"? In this case, if you had included
> the error messages
> /bin/sh: sh -c cat > msg.$FILENO: No such file or directory
> /bin/sh: sh -c cat > msg.$FILENO: No such file or directory
> (etc.)
> you're more likely to get someone telling you that means formail is
> looking for a file named "sh -c cat > msg.$FILENO", not trying to pass
> the options "-c cat > msg.$FILENO" to the command "sh".
>
> This isn't surprising: man formail says:
>     -s has to be the last option specified, the first argument following
>     it is expected to be the name of a program, any other arguments will
>     be passed along to it.
> And the program you're trying to use is called sh.
>
> So
> cat $MAIL | formail -ds sh -c 'cat > msg.$FILENO'
> should do what you want.
>
> Incidentally,
> < $MAIL formail -ds sh -c 'cat > msg.$FILENO'
> or
> formail -ds sh -c 'cat > msg.$FILENO' < $MAIL
> is considered better style, since it saves on a "cat" process. Google
> UUOC for more details.
>
> Hope this helps,
>
> James.
>
> -- 
> E-mail address: james | It's fair enough for a surgeon to refuse to
operate on
> @westexe.demon.co.uk  | someone who won't stop smoking: you've got to give
the
>                       | anaesthetist a chance to get in there.
>                       |    -- "Jeremy Hardy Speaks to the Nation", BBC
Radio 4
>
> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list




More information about the users mailing list