Hi,
Someone please help me to correct the 'expression syntax error' in the following Korn-shell script:
This script checks for presence of 2 lines "Info: " and "Total: " in a file results.log, and if it does,
it extracts a numerical value found in those 2 lines and compares if the values are equal.
Else, it reports that there's no such line in the file.
Thanks,
RV
Someone please help me to correct the 'expression syntax error' in the following Korn-shell script:
Code:
if [ [ `grep -i "Info: .*.txt" results.log` ] && [ `grep -i "Total: " results.log` ] ]
then
x=`awk '/Info: .*.tam/{print $2}' results.log`
y=`awk '/Total: /{print $2}' results.log`
echo "X =" $x > grep.txt
echo "Y =" $y > grep.txt
if [ $x == $y ]
then
echo "matches" > grep.txt
else
echo "fail" > grep.txt
fi
else
echo "NOT found in file \*.txt" > grep.txt
fi
This script checks for presence of 2 lines "Info: " and "Total: " in a file results.log, and if it does,
it extracts a numerical value found in those 2 lines and compares if the values are equal.
Else, it reports that there's no such line in the file.
Thanks,
RV