The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 09-19-2007
brdholman brdholman is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 26
Trying to compare lines in 2 files

Hello, I am new to scripting and need some help. In looking at other posts on this forum, I came up with the following logic. I cannot figure out why I am getting names of files of the current directory in my echo output.

Scenario: message file has a line containing the version. Version.txt contains the correct version. I have to see if the message file's version matches the correct version.

Can you tell me what I am doing wrong??


cat /home/brdholman/testing/Tar/Message.dat | while read LINE
do
#if [[ "$LINE" = "$Version.txt" ]]
VERSION="$LINE"
cat Version.txt | while read LINE2
do
if [[ "$LINE2" = "$VERSION" ]]
then
echo $VERSION
else
continue
#echo not equal
fi
done
done