Paul Bartlett asked,
| Procmail says that sed is an unknown command, except that it is there.
No, that's not what's happening (but yes, sed is there).
| NL="
| "
| :0 w
| | sed -e "1,$/, /$NL/g" $USERLIST | egrep -is $WHOFROM $USERLIST
Bad sed command, Paul: to put a literal newline into a replacement string,
you need to precede it with a backslash (if strong-quoted; two backslashes
if weak-quoted as you have there, so that one survives the shell).
| procmail: Executing " sed -e "1,$/, /$NL/g" $USERLIST | egrep -is $WHOFROM
$USERLIST"
| sed: Unknown command
See; sed is saying "sed: unknown command"; procmail is not saying
"procmail: sed: unknown command" nor "procmail: cannot execute sed."
By not escaping the newline, you're giving sed this script:
1,$/, /
/g
which it sees as two instructions, both of which are unknown commands to sed
(you are missing an "s" as well, and 1,$ is the default range, so you don't
need to specify it).
[I'm also curious about that pipe to egrep; you're specifying a search file
("$USERLIST") on the command line but also feeding egrep some stdin?]
If you want to change all comma/space pairs to newlines in $USERLIST with
sed,
sed "s/, /\\
/g" $USERLIST
without needing $NL. If you love $NL and won't do without it, then,
sed "s/, /\\$NL/g" $USERLIST
| So far I just have not figured out why procmail cannot find sed.
| Note that I have written sed in this form because my sed (SysV,
| apparently) does not recognize sed -e "s/, /$NL/g" $USERLIST
Because the sed instruction is flawed! At least there you have a command
in it ("s"), but you still need to escape the newline.