jzc(_at_)sibs(_dot_)com writes:
Hi, Everybody:
When autorespond to emails received, is there anyway to atache a
consecutive number to it? Say:
1. For the first email received on 02/12/96, Procmail responds with:
Email number: 02129601
Other autoreply text.
2. For the second email received on 02/12/96, Procmail responds with:
Email number: 02129602
Other autoreply text.
How about this?
:0
* Conditions for doing autoresponder go here
{
COUNTFILE = counter
# today is ???
DATE = `date +%d%e%y`
# Last count
LASTDATE = `cat $COUNTFILE`
# Was the last count today? If so, just increment
# (you might need backslashes on the backslash and final dollar sign)
:0
* $ LASTDATE ?? ^$DATE\/.*$
COUNT=|expr $MATCH + 1
# but expr probably doesn't preserve leading zeros
:0 a
{
# I'm paranoid, let's have COUNT be at least 3 digits wide
:0
* COUNT ?? ^..$
COUNT=0$COUNT
:0 e
* COUNT ?? ^.$
COUNT=00$COUNT
}
# Last count wasn't today, start at 000 again
:0 e
COUNT=000
# and the final answer?
NUMBER = $DATE$COUNT
# Store it in the file
:0 ih
|echo $NUMBER > $COUNTFILE
# Rest of stuff goes here
.....
}
Philip Guenther
----------------------------------------------------------------
Philip Guenther UNIX Systems and Network Administrator
Internet: guenther(_at_)gac(_dot_)edu Phonenet: (507) 933-7596
Gustavus Adolphus College St. Peter, MN 56082-1498
Source code never lies (it just misleads). (Programming by Purloined Letter?)