Hi
I have one static file and another one changes daily. We want to change static file as per daily temp file.
static file
========
$ cat tsm02_drives
DRIVE1 1110163753 no
DRIVE10 1110382438 no
DRIVE11 9110812350 no
DRIVE12 1110173780 no
DRIVE13 9110813577 no
temp file
=========
$ cat temp_tsm02_drives
DRIVE1 1110163753
DRIVE10 1110382438
DRIVE11 9110812350
DRIVE12 1110173780
Above files 1st column is drive name and 2nd clumn is drive serial number and 3rd indicates where serial number is changed.
i want to change sattic file 2nd column with temp file 2nd coumn chnages ( new serial number ) and 3rd column in static file to "yes" if that drives serial number changed.
I tried following but comparsion don't work ..
$ cat test.sh
#!/bin/ksh
rm new_tsm02_drives
while read drives serial status
do
newserial=`cat temp_tsm02_drives|grep "$drives"|awk '{print $2}'`
(( diff = $serial - $newserial ))
if [ $diff -eq 0 ]
then
echo "$drives $serial no " >> new_tsm02_drives
else
echo "$drives $newserial yes " >> new_tsm02_drives
fi
done < tsm02_drives
cp new_tsm02_drives tsm02_drives
exit 0
$
I have one static file and another one changes daily. We want to change static file as per daily temp file.
static file
========
$ cat tsm02_drives
DRIVE1 1110163753 no
DRIVE10 1110382438 no
DRIVE11 9110812350 no
DRIVE12 1110173780 no
DRIVE13 9110813577 no
temp file
=========
$ cat temp_tsm02_drives
DRIVE1 1110163753
DRIVE10 1110382438
DRIVE11 9110812350
DRIVE12 1110173780
Above files 1st column is drive name and 2nd clumn is drive serial number and 3rd indicates where serial number is changed.
i want to change sattic file 2nd column with temp file 2nd coumn chnages ( new serial number ) and 3rd column in static file to "yes" if that drives serial number changed.
I tried following but comparsion don't work ..
$ cat test.sh
#!/bin/ksh
rm new_tsm02_drives
while read drives serial status
do
newserial=`cat temp_tsm02_drives|grep "$drives"|awk '{print $2}'`
(( diff = $serial - $newserial ))
if [ $diff -eq 0 ]
then
echo "$drives $serial no " >> new_tsm02_drives
else
echo "$drives $newserial yes " >> new_tsm02_drives
fi
done < tsm02_drives
cp new_tsm02_drives tsm02_drives
exit 0
$