How to read two files simultaneously in linux

Closed
iswaryasenthilkumar Posts 1 Registration date Thursday January 22, 2015 Status Member Last seen January 22, 2015 - Jan 22, 2015 at 07:05 AM
navigatorsystemindia Posts 3 Registration date Wednesday February 25, 2015 Status Member Last seen March 24, 2015 - Mar 23, 2015 at 12:11 AM
i have two sorted files of images(ls -l),i have to compare these two files and check each line are same if it same move to next line if not same i have to rechange it to equal.
bt for me not executing properly
my codings are below
while read line
do
while read lline
do
if [ "$line"=="$lline" ]
then
break
else
sudo cp -r /digital_images/local1/00/00_sortedlist.txt/$line /digital_images local1/00/00_localsortedlist.txt/$lline
fi
done </digital_images local1/00/00_localsortedlist.txt
done </digital_images/local1/00/00_sortedlist.txt
Any one pls give me suggestion for this
Thanks in advance

1 response

navigatorsystemindia Posts 3 Registration date Wednesday February 25, 2015 Status Member Last seen March 24, 2015 1
Mar 23, 2015 at 12:11 AM
If you want to read two files, then you can use the following command:

# cat file1 file2
If you want to compare two file then, use:
# cmp file1 file2
If you want to check the difference then use:
# diff file1 file2
1