Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory.
Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory.
- Copy the first file name from the scp/inbox directory and insert into the pntcompare.dat. Then exit program.
- Otherwise, if there is a file name pntcompare.dat in /pnt/compare directory then capture the first file name from the scp/inbox directory and compare to the file name's information stored inside the pntcompare.dat in /pnt/compare directory.
- If they matched then remove the current file from the /scp/inbox directory to pnt/badfiles directory
- Then create a badpnt.dat file and store the record information from file in /scp/inbox directory..
- Next, remove the pntcompare.dat file from /pnt/compare directory.
- Also remove the touch file (inputloop.touch) from Home directory.
- If they not matched then remove contents in the pntcompare.dat then exit.
Here is an example of the file name pnt.20070327083828.000000066
Here is what I can come up so far, please help.
file=`/$ROOTDIR/pnt/compare -name 'pntcompare.dat' -print`
if [ -z $file ] then
pntcnt=`ls -l /$ROOTDIR/scp/inbox | grep "PNT." | wc -l`
if [[ $pntcnt1 -gt 0 ]] then
ls /$ROOTDIR/scp/inbox | grep "PNT." > /$ROOTDIR/pnt/compare/pntcompare.dat
pntcnt=`wc -l /$ROOTDIR/scp/inbox/pntcompare.dat|awk '{print $1}`
curcnt=1
do
filename=`head -$curcnt /$ROOTDIR/pnt/compare/pntcompare.dat | tail -1`
exit
else
Please help!!!
Thanks