comm command help with unicode chars in file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting comm command help with unicode chars in file
# 1  
Old 07-06-2010
comm command help with unicode chars in file

Hi,

I have a Master file (file.txt) with good and bad records( records with unicode characters). I ahve a file with only bad records (bad.txt)

I want the records in file.txt which are not present in bad.txt ie only the good records.

I tried
Code:
 comm -23 file.txt bad.txt

It is giving all the records in file.txt.
Any help??
# 2  
Old 07-06-2010
you need paste the sample of master file and bad records file
# 3  
Old 07-06-2010
Take this as example.. a1 is master file and a2 is bad record file.My output should be
9
8
6
4
2

Code:
$ cat a1
9
8
7
6
5
4
2
3
$ cat a2
1
3
5
7
$ comm -23 a1 a2
9
8
7
6
5
4
2
3

# 4  
Old 07-06-2010
Hi.
Quote:
Before `comm' can be used, the input files must be sorted
using the collating sequence specified by the `LC_COLLATE'
locale. If an input file ends in a non-newline character,
a newline is silently appended. The `sort' command with no
options always outputs a file that is suitable input to `comm'.

-- excerpt from info coreutils
Best wishes ... cheers, drl
# 5  
Old 07-06-2010
Quote:
Originally Posted by drl
Hi.

Best wishes ... cheers, drl

Is there any way i can do it without sorting the file.The file is big.
# 6  
Old 07-06-2010
find the different.

Code:
$ grep -v -f a2 a1
9
8
6
4
2

find the same records.
Code:
$ grep -f a2 a1
7
5
3

# 7  
Old 07-06-2010
Getting the following error with grep -v -f

Code:
$ grep -v -f a2 a1
grep: illegal option -- f
Usage: grep -hblcnsviw pattern file . . .

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help regarding formatting(comm -23 command)

Hello all , I have two files a.txt and b.txt which have same content . They contain data that is fetched from database through a java program. When I delete a line in a.txt and run the below command comm -13 a.txt b.txt I am not getting the expected result i.e. the line i deleted from... (5 Replies)
Discussion started by: RaviTej
5 Replies

2. 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

3. 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

4. UNIX for Dummies Questions & Answers

Remove Unicode/special chars from XML

Hi, We are receiving an XML file in Unix which has some special characters between tags like '^' etc <Tag> 1e^O7f%<2304e.$d8f57e8^Bf-&e.^Zh7/327e^O7 </Tag> We need to remove all special characters like ^ ones and also any '&' or '<' or '>' being sent within the start and close tags i.e.... (6 Replies)
Discussion started by: dsrookie7
6 Replies

5. 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

6. UNIX for Dummies Questions & Answers

Several file comparison not uniq or comm command

When comparing several files is there a way to find values unique to each file? File1 a b c d File2 a b t File 3 a (3 Replies)
Discussion started by: dr_sabz
3 Replies

7. Shell Programming and Scripting

finding files with unicode chars in the filename

I'm trying to check-in a repository to svn -- but the import is failing because some files waaaay down deep in some graphics-library folder are using unicode characters in the file name - which are masked using the ls command but picked up when piping output to more: # ls -l 1914* -rwxrwxr-x 1... (2 Replies)
Discussion started by: mshallop
2 Replies

8. 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

9. 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

10. 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
Login or Register to Ask a Question