?
Solved

How to use diff ?

Posted on 2002-05-13
6
Medium Priority
?
301 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
  • 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 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.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 …
When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
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
Course of the Month16 days, 23 hours left to enroll

864 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