On 3 Mar, David W. Tamkin wrote:
What's the best way to go about it? Echoing commands to be piped to ed
or ex? Writing the output of some other command (in my case, grep will
do the job) to a temporary file and then renaming the temporary one to
clobber the original?
Yes, I realize that ed or ex would actually write a temporary file and
then clobber the original at the end, but then binary would handle all
that and my procmail code wouldn't have to. However, echoing the
commands into ed or ex in a procmailrc action line might be a
syntactical nightmare.
I don't have crontab access on the system where this all takes place, so
I'm going to have to arrange it by sending trigger messages to my
account there from a system where I do have crontab access and running
the commands from my .procmailrc.
I've used this condition in a recipe that got executed every business
day for at least a couple of years and never had any problems:
* ? perl -i -pe 's/^Z$/\n/;s/^M$//;' $METAMAIL_TMPDIR/$xFILE_FOUND
I know you're not a big fan of Perl but, unless the particular edits
are such that this would be difficult to script or manage, it's a
clean solution. The '-i' option tells Perl to edit the file in place.
It takes an optional argument which becomes an extension to use for
a backup file. I don't know if a temporary file is used, but, if one
is, it is cleaned up automatically.
If I can run any tests for you, I'd be happy to do so.
Don Hammond
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail