On 13 Nov, Collin Park wrote:
| 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" [...]
|
| 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
|
A couple of other possibilities which wouldn't require creating and
removing files.
|dd bs=100 count=1 2>/dev/null
|perl -e 'while(length $msg<101){$msg.=<>;}print unpack(A100,$msg);'
|perl -e 'while(length $msg<101){$msg.=<>;}print substr($msg,0,100);'
I know many people consider perl a 1200 pound gorilla, but at least
everyone should have it. I don't know about dd, which is why I offered
perl. And I don't recall whether unpack or substr is more efficient,
but it probably matters little in this case. Each of these will stop
processing input efficiently; dd after exactly 100 chars, perl after
the first line which surpasses 100 characters, then truncating the
output to 100 chars. Newlines are maintained and counted in all three.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail