procmail
[Top] [All Lists]

Re: truncating body

1997-07-12 05:37:00
At 01:05 AM 7/12/97 +0200, Axel Thimm wrote:
I want to truncate bodies to some given length, I try this with

   :0 fhw
   | formail -A "X-Axel: Too big to download"
   :0 fbw
   | (echo "[... truncated ...]"&&head -50&&echo "[... truncated ...]")
   :0:
   $DOWNLOAD

But it doesn't always work. I sometimes get

procmail: Error while writing to " (echo "[... truncated ...]"&&head -50&&echo 
"[... truncated ...]")"
procmail: Rescue of unfiltered data succeeded

in my logfile.

Since "head" doesn't read its entire input, you will get this error whenever
the entire input isn't written to the pipe before "head" exits.

Use the "i" flag:
    :0 fbwi
    | (echo ....

Cheers,
Stan

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