Execution problems with comm command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execution problems with comm command
# 1  
Old 05-24-2010
Execution problems with comm command

I tried to compare two sorted files with comm command which contain floating values as:

RECT 0 9.8 8.70 7.8 in first file & RECT 0 9.80 8.7 7.80 in second file.

comm -3 first_file second_file should give a empty file but it does not.

Is there a way to compare these two files correctly such that numerical values should be treated as numeral & not as text ?
# 2  
Old 05-24-2010
First sort the files and then run a comm command
# 3  
Old 05-24-2010
The lines are already sorted.
Still it is not working. Problem may be due to mistmatch in exact syntax. Actually in first file values is 9.8 and in another file it is 9.80

Is there any command which takes 9.8 and 9.80 equal?
# 4  
Old 05-24-2010
as per my knowledge there is no command tht might help you with what you are trying to do. (9.8 and 9.80) will be treated differently by unix.

bt if you are comparing two set of datas or two files. then you can write a customized script for yourself.
thats the only way i am able to think off.
but writting a script you gotta take care of all the occurances where decimal comes.
# 5  
Old 05-24-2010
first, remove the ".0" from the files

Code:
sed 's/\.0//g' file1 > a
sed 's/\.0//g' file2 > b

sdiff -s a b


cheers,
Devaraj Takhellambam
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. UNIX for Dummies Questions & Answers

Dsh command : Execution Problems with Cron

Hi, On linux cluster, i created a script to delete all temp files older than 5 days. i am able to execute the script "dsh -ea script.ksh" in management node directly But when i schedule "dsh -ea script.ksh" in crontab in management node it tells dsh command not found. How to solve... (2 Replies)
Discussion started by: smartrajusid
2 Replies

4. Shell Programming and Scripting

Execution problems with grep command in scripting

Hi All, I was looking for grep command option which can exactly matches the word in a file, for examples you may be seeing one word that is also in another word, there might be lkk0lv23 and a lkk0lv234 in which case lkk0lv23 will put BOTH hosts from the grep in. I was using this in a bash... (2 Replies)
Discussion started by: bobby320
2 Replies

5. Shell Programming and Scripting

Execution problems with the jar -tvf command and "if" logic

Hi, I am reading a directory that has a list of jar files. I am searching these files for specific keywords. What i would like to do is write the address of the jar file to a new file if the search result is returned as false. For example; /home/user/JarDirectory/Examplefile.jar ... (2 Replies)
Discussion started by: crunchie
2 Replies

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

7. Shell Programming and Scripting

Execution problems using awk command.

Hi All, I have the following requirement. In a directory i get files from external source. I at regular intervals check that directory for any incoming files. The file name is underscore delimited. Such as: aaa_bbb_ccc_ddd_eee_fff.dat I am using awk and and splitting the file name. ... (4 Replies)
Discussion started by: satishpv_2002
4 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