Sponsored Content
Full Discussion: Need help with comm command
Top Forums UNIX for Dummies Questions & Answers Need help with comm command Post 302668657 by RaviTej on Monday 9th of July 2012 06:28:12 PM
Old 07-09-2012
Need help with comm command

Hello , I am trying to get contents which are only present in a.csv ,so using comm -23

Code:
cat a.csv | sort > a.csv
cat b.csv | sort > b.csv
comm -23 a.csv b.csv > c.csv.

Code:
a.csv
SKU     COUNTRY     CURRENCY     PRICE_LIST_TYPE     LIST_PRICE_EFFECTIVE_DATE
TG430ZA    ZA    USD    DF    2012-03-28    9999-12-31    120000    
TG431ZA    ZA    USD    DF    2012-03-28    9999-12-31    96000    
TG432ZA    ZA    USD    DF    2012-03-28    9999-12-31    1200    
TG433ZA    ZA    USD    DF    2012-03-28    9999-12-31    12000

Code:
b.csv 
SKU     COUNTRY     CURRENCY     PRICE_LIST_TYPE     LIST_PRICE_EFFECTIVE_DATE  
TG431ZA    ZA    USD    DF    2012-03-28    9999-12-31    96000    
TG432ZA    ZA    USD    DF    2012-03-28    9999-12-31    1200    
TG433ZA    ZA    USD    DF    2012-03-28    9999-12-31    12000

When I run the script , expected result is (2nd line of a.csv TG430ZA is not present in b.csv)
Code:
TG430ZA    ZA    USD    DF    2012-03-28    9999-12-31    120000

but I am getting
Code:
SKU     COUNTRY     CURRENCY     PRICE_LIST_TYPE     LIST_PRICE_EFFECTIVE_DATE
TG430ZA    ZA    USD    DF    2012-03-28    9999-12-31    120000

Can any help me on this please. I have tried using comm -2 -3 also ..its same

Last edited by methyl; 07-10-2012 at 07:38 AM.. Reason: Please use code tags.
 

10 More Discussions You Might Find Interesting

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

2. UNIX for Advanced & Expert Users

comm command in sorting IP

i have 2 files that contains a sorted list of IP addresses. file_A contains a list of all IPs file_B contains only around 50% of what is in file_A. I tried to execute comm -23 file_A file_B > file_C to get the difference. My objective is to put all the IPs that are in file_A but not... (1 Reply)
Discussion started by: tads98
1 Replies

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

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

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

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

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

9. UNIX for Beginners Questions & Answers

How to ignore Case with in COMM command?

Hi, How can i ignore case between 2 files in unix using COMM command. 2 input files are: -bash-4.1$ more x2.txt HELLO hi HI raj -bash-4.1$ more x3.txt hello hi raj COMM command: -bash-4.1$ comm x2.txt x3.txt hello HELLO hi (3 Replies)
Discussion started by: raju2016
3 Replies

10. Shell Programming and Scripting

Highlight 'comm' command output

Given the output below (simplified) extracted from the comparison of two curl -I commands saved in two different files, I am looking for the best approach to highlight the following scenarios in a script: this header exists only in file1.txt but this one does not this one exists in both cases... (1 Reply)
Discussion started by: muppets
1 Replies
Text::CSV::Encoded::Coder::EncodeGuess(3pm)		User Contributed Perl Documentation	       Text::CSV::Encoded::Coder::EncodeGuess(3pm)

NAME
Text::CSV::Encoded::Coder::EncodeGuess - Text::CSV::Encoded coder class using Encode::Guess SYNOPSIS
use Text::CSV::Encoded coder_class => 'Text::CSV::Encoded::Coder::EncodeGuess'; use Spreadsheet::ParseExcel; my $csv = Text::CSV::Encoded->new(); $csv->encoding( ['ucs2', 'ascii'] ); # guessing ucs2 or ascii? $csv->encoding_to_combine('shiftjis'); my $excel = Spreadsheet::ParseExcel::Workbook->Parse( $file ); my $sheet = $excel->{Worksheet}->[0]; for my $row ( $sheet->{MinRow} .. $sheet->{MaxRow} ) { my @fields; for my $col ( $sheet->{MinCol} .. $sheet->{MaxCol} ) { my $cell = $sheet->{Cells}[$row][$col]; push @fields, $cell->{Val}; } $csv->combine( @fields ) or die; print $csv->string, " "; } DESCRIPTION
This module is inherited from Text::CSV::Encoded::Coder::Encode. USE
Except for 2 attributes, same as Text::CSV::Encoded::Coder::Encode. encoding_in $csv = $csv->encoding_in( $encoding_list_ref ); The accessor to an encoding for pre-parsing CSV strings. If no encoding is given, returns current $encoding, otherwise the object itself. $encoding_list_ref = $csv->encoding_in() When you pass a list reference, it might guess the encoding from the given list. $csv->encoding_in( ['shiftjis', 'euc-jp', 'iso-20022-jp'] ); If it cannot guess the encoding, the first encoding of the list is used. encoding $csv = $csv->encoding( $encoding_list_ref ); $encoding_list_ref = $csv->encoding(); You can pass a list reference to this attribute only: * For list data consumed by combine(). * For list reference returned by getline(). In other word, in "combine" and "print", it might guess an encoding for the passing list data. If it cannot guess the encoding, the first encoding of the list is used. SEE ALSO
Encode, Encode::Guess AUTHOR
Makamaka Hannyaharamitu, <makamaka[at]cpan.org> COPYRIGHT AND LICENSE
Copyright 2008-2010 by Makamaka Hannyaharamitu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-04-26 Text::CSV::Encoded::Coder::EncodeGuess(3pm)
All times are GMT -4. The time now is 05:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy