[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to use diff ?

Posted on 2002-05-13
6
Medium Priority
?
294 Views
Last Modified: 2010-04-21
I would like to use diff to compare two files.
I don't care for the CASE(A and a are same).
I would I do it ?
0
Comment
Question by:tanc02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 21

Expert Comment

by:tfewster
ID: 7006448
diff -i file1 file1 will show the lines where the files differ, ignoring case. (man diff)

You may prefer to use sdiff to show the 2 files side by side, with the differences marked
0
 
LVL 21

Expert Comment

by:tfewster
ID: 7006455
diff -i file 1 file2 (-i ignores case)

You may prefer to use sdiff to display the files side-by-side
0
 
LVL 21

Expert Comment

by:tfewster
ID: 7006459
Whoops, wasn't sure if the 1st post had worked :-)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:tanc02
ID: 7006469
This is waht I have in file 1 :
1
2
3
4
5

in file 2 :
1
2
5
6
7

Then, I issued this command : diff -1 1 2, and I got :

3, 4d2
< 3
< 4

5a4, 5
> 6
> 7

Can anyone show me how to read that output ?
0
 
LVL 21

Expert Comment

by:tfewster
ID: 7006560
diff only shows the differences between the 2 files. The "codes" are the ed commands needed to change file1 so it is identical to file2 - i.e. delete 2 lines from file1 and append two of the lines from file2.

The < and > shows the detail of the lines that are actually different between the two files.



0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 200 total points
ID: 7006882
> Can anyone show me how to read that output ?
read output as follows:

  remove from first file line 3 and 4 (3,4d2)
  then add in first file after previous line 5 line 4 and 5 (aka: line 6 and 7 from second file) (5a4,5)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question