procmail
[Top] [All Lists]

Re: How to remove the last part of the body

2000-11-13 17:27:34
Andreas Tindlund wrote:
Hi. 

I have tried the recipe you gave me but it returns an error. The log says 

procmail: Executing "head,-c,100"
head: illegal option -- c

I don't understand what is wrong. I have left a larger cut of the log
below. Do you see what is wrong?

You have a version of "head" that doesn't support "-c".

You could find and install "head (GNU textutils) 1.22" which gives the
following help message:

    $ head --help
    Usage: head [OPTION]... [FILE]...
    Print first 10 lines of each FILE to standard output.
    With more than one FILE, precede each with a header giving the file name.
    With no FILE, or when FILE is -, read standard input.

      -c, --bytes=SIZE         print first SIZE bytes
      -n, --lines=NUMBER       print first NUMBER lines instead of first 10
      -q, --quiet, --silent    never print headers giving file names
      -v, --verbose            always print headers giving file names
          --help               display this help and exit
          --version            output version information and exit

    SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.
    If -VALUE is used as first OPTION, read -c VALUE when one of
    multipliers bkm follows concatenated, else read -n VALUE.

    Report bugs to textutils-bugs(_at_)gnu(_dot_)ai(_dot_)mit(_dot_)edu

The hpux 10.20 version of "head" supports the '-c' option, so it's
astonishing that yours doesn't.


If your "split" command supports "-b" then the below might work.  (The
hpux 10.20 version of "split" does support "-b").  You might want to
do something like

    echo sldkjfslkdjfsdlkfjlksdjfsldkjfsdlkjflskjdsdlkfj | split -b 15

to see if you get files xaa,xab,xac,xad (move any important files out
of the way first!).  If that works, the below is likely to work for
you.  Again, this is untested.

    # Modify one copy to forward
    :0c
    {

        # Remove all but From/Subject from header

        :0 fhwi
        | formail -f -XzFrom: -XzSubject:

        # Trim message to 300 bytes total

        LOCKFILE=splitlockfile

        :0 fwi
        | (rm -f xa[a-z]; split -b 300; cat xaa; echo)

        LOCKFILE

        # Send it!
        :0
        ! other(_at_)email(_dot_)address

        # You can't get here

        LOG="forward to other(_at_)email(_dot_)address didn't work :^<
"
        :0
        /dev/null        
    }

hth
collin
-- 
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry.
Collin Park                         Not a statement of my employer.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>