Hello Friends,
I have file called reference.txt which looks like below,
Quote:
wahabeua |3.1 |wahabeua-1.1.11 |Not available |Code Coverage
ferrari12 |4.0 |ferrari12-1.1.21|Not applicable |Code Coverage
masterpiece |4.1 |masterpiece-2.2.33 |File Changes |Code Coverage
columns are been formed by delimiter "|" as shown. I am required to scan whole file line by line & compare 1st 2 columns with new name (ex. ferrari) & new version (2.1).
CODE PURPOSE: whnever new project formed compare if it already exists & compare if version updated.
My Code
Quote:
for file in $(cat reference.txt);do
if [[ `echo $file | cut -d ',' -f1` == $PROJECT ]];then
echo "Project Matched"
if [[ `echo $file | cut -d ',' -f2` == $VERSION ]];then
echo "Project & Version Matched"
else
echo "Project Matched but Version Revised"
fi
else
echo "Complete New Project"
fi
echo "$n"
let "n += 1"
done
By executing my code i am finding,
1. its looping for 19 times instead of looping for only 3 times. & providing 3 output for 3 rows.
Kindly help. Thanks a lot.