Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outputting files.

Status
Not open for further replies.

tijerina

Vendor
Mar 4, 2003
132
US
Can someone help me output results to a file and have the names of the output files change everyday? Example: Outputfile1 would be dirname_april_4 and so on. Outputfile will have the name of the directory we are searching and the date. I am not sure how to do this.

Here is the script:

#!/bin/ksh -x

set -x

callci "showjob"

SERVER=`uname -n`
DATE=`date`
TOCDISC=/DJ/PUB/TOCDISC3
OUTFILE=/DJ/PUB/OUTFILE

for iii in `cat ${TOCDISC}`
do
V1=`echo ${iii}|/bin/cut -d ":" -f1`
V2=`echo ${iii}|/bin/cut -d ":" -f2`
V3=`/bin/ls -l ${V1}|awk '{print $5}'`

if [ ! -f ${V1} ]
then
print "THIS FILE WAS CREATED ON:--------${SERVER}" > OUTFILE
print "CREATION DATE IS:----------------${DATE}" >> OUTFILE
print "FILE MISSING:--------------------${V1}" >> OUTFILE
ls /SYS/PUB/LOG*
else
if [ ${V2} -ne ${V3} ]
then
print "BYTE ERROR WITH: ${iii}" >> OUTFILE
print "YOU SHOULD HAVE: ${V3}" >> OUTFILE
print "CHECK S/W VERSION!" >> OUTFILE
fi
fi
done
 
Assuming this script is invoked once per day then the following ought to help.

cd /DJ/PUB
OUTFILE="`basename ${PWD}`_`\date '+%B_%d' |
tr -s '[:upper:]' '[:lower:]'`"
Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top