How to read two files simultaneously in linux

Closed
iswaryasenthilkumar Posts 1 Registration date Thursday 22 January 2015 Status Member Last seen 22 January 2015 - 22 Jan 2015 à 07:05
navigatorsystemindia Posts 3 Registration date Wednesday 25 February 2015 Status Member Last seen 24 March 2015 - 23 Mar 2015 à 00:11
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
Related:

1 response

navigatorsystemindia Posts 3 Registration date Wednesday 25 February 2015 Status Member Last seen 24 March 2015 1
23 Mar 2015 à 00:11
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