comm ?!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting comm ?!
# 1  
Old 12-02-2003
comm ?!

Hi,
I have two large files with uid's:
- 581004 File1.txt
- 292675 File2.txt

I want to know which uid's are in File1.txt and not in File2.txt.
I have used comm -23 File1.txt File2.txt. This should do the trick i thought. But in the output i keep having uid's in File1.txt that are also in File2.txt, so not unique!!
I got rid of all the spaces, sorted them etc. (sort -u).
Has anyone any other options i can try?
Are my files too big?

I have tried the comm statement with smaller files with just a few names and than it works the way it should.
Tine
# 2  
Old 12-02-2003
Try...

grep -vf File2.txt File1.txt

... but comm should work, perhaps its limit has been exceeded.
# 3  
Old 12-02-2003
What is this:
- 581004 File1.txt
- 292675 File2.txt
supposed to mean? Number of lines? Characters? Or something else?

You give two theories as to the contents of the files: uids, and names. What kind of data do you really have?

How did you get rid of the spaces? What sort parameters did you use? Really just sort -u?

My guess is that you don't have the files properly sorted for comm, but I can't tell for sure with the sparse information you provided. Post some of the input that you're feeding into comm.
# 4  
Old 12-03-2003
The numbers are the size of the file..

Quote:
You give two theories as to the contents of the files: uids, and names. What kind of data do you really have?
The content of the files i want to get the unique values are uid's, the files i used to test with contain names:
Quote:
I have tried the comm statement with smaller files with just a few names and than it works the way it should.
I got rid of the spaces by using sed 's/ //g' File.txt
To sort the file i used sort -u File.txt

These are a few of the uid's i have in the files:

a01
ali01
aloy01
araby01
atjak01
aa01
aa02
aa03
aa04
aa05
aa06
aa07
aabouz01
aachic01
aaddab02
aaddi01
aadrou01
aafar01
# 5  
Old 12-03-2003
some extra info: File1 contains 3500 uid's, File2 contains 6500 uid's
# 6  
Old 12-03-2003
Those files don't seem very big. I tried some tests with comm and I could not get a failure. I suppose that you could have buggy version of comm. Can you try it on another system?

Remember, a missorted input file is guaranteed to make comm fail like this. Ate you sure you had the same LOCALE during both sort and comm? If you use an exotic LOCALE, try setting your LOCALE to C.

And btw, uids are integers, perhaps those are user names.
# 7  
Old 12-05-2003
QUOTE]And btw, uids are integers, perhaps those are user names.[/QUOTE]
uid stands for Unique ID, and as long as it is unique, it can consist of anything! A user name can also be a uid..[
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

comm command help

The manual does not cover this very well. What do the following compares will do ? 1) comm -13 file1 file2: will it display what is in file2 not in file1? 2) comm -23 file1 file2: will it display what in 1 but not in 2 ? Thanks (5 Replies)
Discussion started by: mrn6430
5 Replies

2. UNIX for Dummies Questions & Answers

Need help with comm command

Hello , I am trying to get contents which are only present in a.csv ,so using comm -23 cat a.csv | sort > a.csv cat b.csv | sort > b.csv comm -23 a.csv b.csv > c.csv. a.csv SKU COUNTRY CURRENCY PRICE_LIST_TYPE LIST_PRICE_EFFECTIVE_DATE TG430ZA ZA USD DF ... (4 Replies)
Discussion started by: RaviTej
4 Replies

3. Shell Programming and Scripting

HPUX and comm command

I need to compare 2 files. I need to see if 1 file has records that are not in a second file. I did some searching and found the 'comm' command. According to the man pages comm -23 test1.txt test2.txt Will tell me what is in file 1 and not in file 2. So I did a simple test test1.txt has the... (3 Replies)
Discussion started by: guessingo
3 Replies

4. UNIX for Dummies Questions & Answers

help on COMM command please

could some one please explain with examples how comm -12 & comm -3 works. I am confused with manual page, Thankyou. (2 Replies)
Discussion started by: Ariean
2 Replies

5. UNIX for Dummies Questions & Answers

help in comm command

Hi all, I need help in comm command , I am having 2 files . I have to display the common line in the two file only onnce and i have to also display the non common line as well. tmpcut1 -- First file cat tmpcut1 smstr_303000_O_432830_... f_c2_queue_sys30.sys30 RUNNING 10 1000... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

6. Shell Programming and Scripting

problem with using comm

hi, I have two unsorted files and want to delete the lines which are common to both. file 1: S1069656304010437 S1069656304010449 S1470204501005393 S1069656304010474 S0001209208001294 S0000000012345678 S0001457507000590 S0002641707000784 S1470204501005381 S0001457507000280... (4 Replies)
Discussion started by: jathin12
4 Replies

7. Shell Programming and Scripting

comm not working

Hi Sorry if this a repeat question, I have the following two files. Both are sorted. file1 ---- CSCeb69473 CSCsg70355 CSCsj78917 CSCsj85065 CSCsl48743 CSCsl72823 CSCsl77748 file2 ---- CSCsg39295 (7 Replies)
Discussion started by: amitrajvarma
7 Replies

8. Shell Programming and Scripting

comm command

Hi I have issue with "comm " command file-1 ---- l65059 l65407 l68607 l68810 l69143 l71310 l72918 l73146 l73273 l76411 file-2 ----- (8 Replies)
Discussion started by: amitrajvarma
8 Replies

9. UNIX for Dummies Questions & Answers

Comm, command help

See my other post on sdiff .... I don't think sdiff is able to do what I want. The 'comm' command does what I need and works fine as far as the logic and results. The problem I'm having is with the output format, it outputs 3 columns of data, but because of the way it starts each line... (2 Replies)
Discussion started by: cowpoke
2 Replies

10. Shell Programming and Scripting

comm with a variable

Hello all, I have two flat files that are colon delineated and I am trying to run a compare (Solaris v8 ksh) of $1 within a script to access a mysql database based on the results. Unix is telling me that it has to have physical file names. Is there a way to run a compare using variables? This is... (3 Replies)
Discussion started by: gozer13
3 Replies
Login or Register to Ask a Question