difference between 2 files in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers difference between 2 files in unix
# 8  
Old 01-27-2011
Hmm.
Please post the output from this command which is designed to make invisible characters visible. I suspect that your data files are in MSDOS text file format not unix text file format.

Code:
sed -n l file1

sed -n l file2


Last edited by methyl; 01-27-2011 at 11:47 AM..
# 9  
Old 01-28-2011
try this.

diff file1 file2|grep ^[\>,\<]
# 10  
Old 01-28-2011
diff does not need sort, comm needs sorted unique data (sometimes I count the dups with uniq -c and move the count to the right end using sed between sort and comm). If you want the original order, diff is the right tool, and do not overlook the options.
# 11  
Old 01-28-2011
Quote:
diff does not need sort, comm needs sorted unique data (sometimes I count the dups with uniq -c and move the count to the right end using sed between sort and comm). If you want the original order, diff is the right tool, and do not overlook the options.
This is complete and utter gibberish.

The issue which the O/P faces is that the "diff" command outputs the diferences in context complete with irrelevent lines and other output. This form of screen output is useless for further data processing.
The O/P wishes to process the differences.

However the input data files are clearly not unix text format so the whole concept is academic.
# 12  
Old 01-31-2011
grep -v -f File1 File2 > File3
# 13  
Old 01-31-2011
diff file1 file2|grep ^[\>,\<] fetched me this ....
> 2
> 2
> 3
Sheel: tried your command..got this error....grep: illegal option -- f
Guys, any help is highly appreciated.

---------- Post updated at 07:25 AM ---------- Previous update was at 07:15 AM ----------

Methyl: sed -n l file1 is not working
error message: syntax error at line 3 : `(' unexpected
ksh: 22599 Segmentation Fault(coredump)
win4luv
# 14  
Old 02-01-2011
What Operating System and version are you running?
What Shell are you using?
Are you using a Microsoft Windows editor instead of a unix/Linux editor to prepare test data and/or scripts?


These commands should work. Type them at the command prompt while in the same directory as file1 and file2. The error message you report relates to misplaced quotes and there aren't any in these commands.
Code:
sed -n l file1

sed -n l file2

 
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