Hi all;

Got a newbie question for you.  I have a number of exactly 10 digits
(2001090701) and I want to be able to read it from a file, cut the first 8
digits from the last two digits and put each into a variable (for comparison
and addition).  I would do it in the korn shell like this:

NUM=`grep Serial FILE | awk '{print $1}'`
TODAY=`date '+%Y%m%d'`
FDAY=`echo $NUM | cut -c 1-8`
typeset -Z2 INCR
INCR=`echo $NUM | cut -c 9-10`
if [ $FDAY -ne $TODAY ]; then
        SNUM="${TODAY}01" 
else
        let INCR="$INCR + 1"
        SNUM="${TODAY}${INCR}"
fi
print "                 $SNUM   ;Serial" >> NEWFILE

However, I need to insert this logic into an existing perl script and am
only vaguely familiar with Perl (I can figure out what they do - but do most
of my programming in sh or ksh)

Thanks so much,
Chris

P.S.  Please respond to my email address.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to