How to read two files simultaneously in linux

[Closed]
Report
Posts
1
Registration date
Thursday January 22, 2015
Status
Member
Last seen
January 22, 2015
-
Posts
3
Registration date
Wednesday February 25, 2015
Status
Member
Last seen
March 24, 2015
-
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 reply

Posts
3
Registration date
Wednesday February 25, 2015
Status
Member
Last seen
March 24, 2015
1
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
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month