Re: Spitting a Mailbox into separate files with formail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux