Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the difference between commmands cmp and diff?

Answer Posted / s.sunny

cmp compares the files byte by byte and in first occurence
it shows if any unmatch character will found in error which
contains char no./column no. and line no.

diff is command which tells how to make the files identical.
the o/p is very confussing way. easy way that diff compares
files line by line.
Example:
test1: test2:
1.test! 1.test!
2.a common line. 2.a almost common line.
3.really common line. 3.really common line.
4.one more common line. 4.really not common line.
5.only here. 5.one further line.
6.one more common line.
o/p:
2c2
< A common line.
---
> A almost common line.
3a4,5
> Really not common line.
> One further line.
5d6
< Only here.
imp:
first file (<)
second file (>)
dashed line (-)--> separate o/p from two files.
imp:
c : replace line
d : delete line
a : add line
imp:
1. line 2 differ both files.(which present symbol 'c')
2. line 4 & 5 of 2nd file add in 1st file after 3 line.
(which present symbol 'a')
3. line 5 of file 1 no need to exchange with file 2 for
making 2 files identical, so we delete line 5 from file 1.
(5d6--> line 5 delete from file 1 and that 6 no. shows that
total line 6 in both files means ending line no.)

that's it friends. read carefully....understand each and
every line...u can easily find the meaning of diff and
working...
take care.........

Is This Answer Correct ?    12 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a command that will find all text files in a directory such that it does not contain the word "amazing" in any form (that is, it must include the words amazing, amazing, or amazing)?

1507


What is nr in awk command?

1128


Name the unix command to find how many days the server has been up.

1108


Which command is used to create a directory?

1090


What is {} in find command?

1048


What is unix command line?

1171


How do I use grep to search for a file?

1008


Differentiate cmp command from diff command.

1096


Write a command to display a file’s contents in various formats?

1144


What do chown command do?

1113


Name the various commands that are used for the user information in unix.

1018


What are the unix commands?

1026


What does grep v do?

998


Enlist some filename manipulation commands in unix.

1078


How do you grep recursively?

1054