difference between 2 files in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers difference between 2 files in unix
# 15  
Old 02-01-2011
diff -C999999 tends to give you all the data of both files. How is that not suitable for processing?
# 16  
Old 02-01-2011
@DGPickett
In post #1 the expected output from the process was one line - the line containing "3".


On my version of "diff" we get quite a lot of unwanted output from "diff -C 999999". Admittedly it is possible to fish out the differences by writing a program to unravel the output from "diff".
Code:
diff -C 999999 file1 file2
*** file1    Tue Feb  1 17:09:30 2011
--- file2    Tue Feb  1 17:10:16 2011
***************
*** 1,3 ****
--- 1,4 ----
  1
  1
  2
+ 3

There are much much better methods. The only way that I can explain that my post #4 did not work is if these are not unix text files. Another explanation is that this is a MAC or some weird Linux like Busybox.
# 17  
Old 02-01-2011
No fishing, the diffs start with +/-, but of course if the records are not bound by a symbol and run across many lines, the keys needed to process the diffs are hard to deal with. Now, if the key fields are sometime before and sometimes after the diffs, life gets seriously twisty. It seems like the files need to be parsed into a rectangular normal matrix of rows and columns, and then compared.
# 18  
Old 02-01-2011
Hmm. Just realised that in post #7 the O/P might have run "comm" with no parameters.
I don't think that my post #4 has been run by the O/P.
We really need some representative data because the O/P mentioned that these are actually logfiles and has not answered questions about the order of the data. From the reaction to "diff" the files are not proper unix text files ... or maybe they are active logs?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Comparing two files and list the difference with common first line content of both files

I have two file as given below which shows the ACL permissions of each file. I need to compare the source file with target file and list down the difference as specified below in required output. Can someone help me on this ? Source File ************* # file: /local/test_1 # owner: own #... (4 Replies)
Discussion started by: sarathy_a35
4 Replies

2. UNIX for Dummies Questions & Answers

difference between unix and linux

Hi I am new to linux I have dout waht is the difference between UNIX and LINUX Is there any soft for insatallation for UNIX OS Thanks (0 Replies)
Discussion started by: sanjaya
0 Replies

3. Shell Programming and Scripting

Difference Between 2 files in UNIX

Hi, I am having files in the below format $ cat a.txt 1, abc, 1234 2, bcd, 2345 $ cat b.txt 1, bcd, 2345 2, cde, 3456 and I want to display only what is not exists in a.txt through UNIX script. like 2, cde, 3456 Please advice me. (1 Reply)
Discussion started by: Alex_Smith
1 Replies

4. UNIX for Dummies Questions & Answers

Difference between windows and Unix

Hi all, can anyone share any URl or link which is about the main 20 advantages and features of unix over windows i mean i need camparison matrix between windows and any flavour of unix. thanks a lot in advance for sharing. Best Regards (4 Replies)
Discussion started by: younusdba
4 Replies

5. Solaris

difference between unix and genunix files

Hi, Please explain difference between unix and genunix files in solaris. Thanks in advance (4 Replies)
Discussion started by: bpsunadm
4 Replies

6. UNIX for Dummies Questions & Answers

Unix difference

Hi, What is the difference between the following unix ie.. Linux-unix, HP-Unix, AIX, Solaris Unix... whether commands used in all unix are same? and which one is best?..... (2 Replies)
Discussion started by: gwgreen1
2 Replies

7. UNIX for Dummies Questions & Answers

Difference between UNIX and Linux

OK, I've used various versions of UNIX(Solaris, HPUX, etc..) over the years. Now the organization I work for is leaning towards more Linux based systems(Redhat, Suse, etc..) I do see differences in in comands and how to accomplish basic adminstration, but nothing mind blowing. So, what is it... (5 Replies)
Discussion started by: pbonilla
5 Replies

8. UNIX for Dummies Questions & Answers

difference between unix and linux?

Ok, I'm confused. Can someone answer these (stupid) questions please for me? 1. What is the difference between unix and linux? 2. Is FreeBSD a unix distribution? 3. If not, then what is Unix? I actually gone to Unix.com because I thought this is it's official website where I could download... (1 Reply)
Discussion started by: RellioN
1 Replies

9. UNIX for Dummies Questions & Answers

Difference between UNIX operating system and Unix Open Server

Hi, I recently joined this forum and new to UNIX. Is there any difference between UNIX operating system and UNIX open server? Please explain. (1 Reply)
Discussion started by: Manjit
1 Replies
Login or Register to Ask a Question