?
Solved

How to use diff ?

Posted on 2002-05-13
6
Medium Priority
?
292 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

764 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