I have a file test001.lst its contents are some what like this
czebicdic2500.ctl
ctltest1.ctl
ctltest2.ctl
ctltest3.ctl
ctltest4.ctl
each of which are files in a dircotry
Contents in czebicdic2500.ctl
DATA_NAME='XYZ'
DATA_CPYBOOK='CZ2500'
DATA_HOST='PUZ'
DATA_DML='xm_cz_ascii.dml'
DATA_PATH='/disco/omfs/xyz_omfs/main'
similarly are the others ctltest1.ctl, ctltest2.ctl......
I have written a script to do some manipulation on this .ctl file like this
test.ksh
if [ -z $1 ]; then
echo "Usage: test.ksh <ctrl filename>"
exit 1;
fi
export F_name1=`grep DATA_NAME $1 | awk -F"'" '{print $2}'`
echo $F_name1
export F_name2=`grep DATA_CPYBOOK $1 | awk -F"'" '{print $2}'`
echo $F_name2
export F_path=`grep DATA_PATH $1 | awk -F"'" '{print $2}'`
echo $F_path
export F_FULL_name="${F_path}/${F_name1}_${F_name2}"
echo $F_FULL_name
ls "$F_FULL_name"
if [[ $1 !=1 ]] then
echo "Dat file available"
else
echo "Dat file not available"
echo "Delete ctl file Processing"
rm $1
fi
Now i want to pass the ctl file names from .lst file which is mensioned earlier
Along with i need a summary of the deleted files and how much are the totol of the bytes are the delted files
eg., from the test001.lst
czebicdic2500.ctl
ctltest1.ctl
ctltest2.ctl
ctltest3.ctl
ctltest4.ctl
ctl1test1.ctl and ctltest2.ctl have been deleted according to the logic in test.ksh so the summary after processing the test001.lst should be
files delted 000002
space freed 250 MB or GB accordingly
can any one please help me its very urgent!!!
Thanks inadvance
[i formulated a hint
delete.ksh
1. go to test0001.lst
2. first line .ctl take it
3. get the count + get the size of the first line .ctl file
4. pass this .ctl file name to test.ksh's parameter as test.ksh <first line>
5. test.ksh <fistname> if the dat is available then this count -1 else count = count {first time}
6. go the 2nd line get the 2nline .ctl file
7 again get the count + get the size of the 2nd line.ctl file
8. test.ksh <secondline filename> if the dat file is not avaible then count = count +1 else count=count
]