Hi All,
I am trying to read a file as input and pull out some information from the file and put it into another file in column format and then take that file and make it an excel file. My problem is that I'm trying to put the date in one of the columns using a variable in an awk cmd, but when I do this I get some decimal number not the date. Can anyone help here is my code:
#!/bin/sh -x
# Script to pull out the tape number and expiration date from the Vault report file.
##########################################
FILEDIR=/usr/openv/netbackup/vault/reports
MONTH=`date +%b`
CURYEAR=`date +%Y`
NEXTYEAR=`expr $CURYEAR + 1`
TENYEAR=`expr $CURYEAR + 10`
IDATE=`date +%m/%d/%Y`
#This will find the latest summary file.#
FILE1=`ls -ltr $FILEDIR/summary_distlist_vault_??????????.rpt| awk '{ print $9 }' | sed -n '$p'`
OFFSITE=/tmp/offsite_tapes.xls
################################################################################################
# Remove the last offsite files before creating a new one.#
if [ -s $OFFSITE ];then
rm $OFFSITE
fi
cd $FILEDIR
# This should pars the latest file and pull out "MEDIA ID" and "EXPIRATION" and create the "$OFFSITE" file.#
cat $FILE1 | grep -Ev "$MONTH|full" | egrep "$CURYEAR|$NEXTYEAR|$TENYEAR" | awk '{ print "\t""\t"$2"\t""\t"$IDATE"\t"$3 }' > $OFFSITE
chmod 777 $OFFSITE
#Email the Excel file#
uuencode $OFFSITE offsite_tapes.xls | mailx -s "Offsite Tape Spreadsheet"
email@something.com
##################################################
The red part is what's giving me the trouble. $IDATE is suppose to be the system date and I get a decimal number in the excel file. Thanks in advance for any help you can give me.