Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 18 characters in body
Source Link
Siva
  • 9.3k
  • 9
  • 60
  • 88

I have two files file1.csv and file2.csv.

Below are the contents of file1.csv

    AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
    AR.jar;9a553dd203d0979aa60004e19cc98c12
    BI.jar;8022f6c5f83ba040394ff0b0a0323e8e
    BV.jar;f53c4a8c988aa8806b54063ebc682803
    CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5
CO.jar;b2f7a0ab6e646d6793631e5c97e05096

file2.csv

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;cfb994078ff4373c7e0f15de19830a3d
Common.jar;a09b520288870aa3888194ce59179dbd

We need to compare two files based on the contents.

I want to make diff which is based only on values of first column, so the result should be

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                         AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                         <NULL>
BV.jar;f53c4a8c988aa8806b54063ebc682803                        BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5              CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                         CO.jar;cfb994078ff4373c7e0f15de19830a3d
<NULL>                                                          Common.jar;a09b520288870aa3888194ce59179dbd

I have tried the below command

diff -y file1.csv file2.csv

But the below output is not as expected.

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                       | AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                       | BV.jar;213d9df82095764702ef4929424a1a0c
BV.jar;f53c4a8c988aa8806b54063ebc682803                       | CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5            | CO.jar;cfb994078ff4373c7e0f15de19830a3d
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                       | Common.jar;a09b520288870aa3888194ce59179dbd

Any idea how can my expected output be achieved!

I have two files file1.csv and file2.csv.

Below are the contents of file1.csv

    AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
    AR.jar;9a553dd203d0979aa60004e19cc98c12
    BI.jar;8022f6c5f83ba040394ff0b0a0323e8e
    BV.jar;f53c4a8c988aa8806b54063ebc682803
    CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5
CO.jar;b2f7a0ab6e646d6793631e5c97e05096

file2.csv

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;cfb994078ff4373c7e0f15de19830a3d
Common.jar;a09b520288870aa3888194ce59179dbd

We need to compare two files based on the contents.

I want to make diff which is based only on values of first column, so the result should be

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                         AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                         <NULL>
BV.jar;f53c4a8c988aa8806b54063ebc682803                        BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5              CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                         CO.jar;cfb994078ff4373c7e0f15de19830a3d
<NULL>                                                          Common.jar;a09b520288870aa3888194ce59179dbd

I have tried the below command

diff -y file1.csv file2.csv

But the below output is not as expected.

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                       | AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                       | BV.jar;213d9df82095764702ef4929424a1a0c
BV.jar;f53c4a8c988aa8806b54063ebc682803                       | CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5            | CO.jar;cfb994078ff4373c7e0f15de19830a3d
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                       | Common.jar;a09b520288870aa3888194ce59179dbd

Any idea how can my expected output be achieved!

I have two files file1.csv and file2.csv.

Below are the contents of file1.csv

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e
BV.jar;f53c4a8c988aa8806b54063ebc682803
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5
CO.jar;b2f7a0ab6e646d6793631e5c97e05096

file2.csv

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;cfb994078ff4373c7e0f15de19830a3d
Common.jar;a09b520288870aa3888194ce59179dbd

We need to compare two files based on the contents.

I want to make diff which is based only on values of first column, so the result should be

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                         AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                         <NULL>
BV.jar;f53c4a8c988aa8806b54063ebc682803                        BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5              CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                         CO.jar;cfb994078ff4373c7e0f15de19830a3d
<NULL>                                                          Common.jar;a09b520288870aa3888194ce59179dbd

I have tried the below command

diff -y file1.csv file2.csv

But the below output is not as expected.

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                       | AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                       | BV.jar;213d9df82095764702ef4929424a1a0c
BV.jar;f53c4a8c988aa8806b54063ebc682803                       | CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5            | CO.jar;cfb994078ff4373c7e0f15de19830a3d
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                       | Common.jar;a09b520288870aa3888194ce59179dbd

Any idea how can my expected output be achieved!

edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
Source Link
sabarish jackson
  • 628
  • 4
  • 16
  • 31

Diff between two csv files based on the column

I have two files file1.csv and file2.csv.

Below are the contents of file1.csv

    AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
    AR.jar;9a553dd203d0979aa60004e19cc98c12
    BI.jar;8022f6c5f83ba040394ff0b0a0323e8e
    BV.jar;f53c4a8c988aa8806b54063ebc682803
    CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5
CO.jar;b2f7a0ab6e646d6793631e5c97e05096

file2.csv

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;cfb994078ff4373c7e0f15de19830a3d
Common.jar;a09b520288870aa3888194ce59179dbd

We need to compare two files based on the contents.

I want to make diff which is based only on values of first column, so the result should be

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                         AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                         <NULL>
BV.jar;f53c4a8c988aa8806b54063ebc682803                        BV.jar;213d9df82095764702ef4929424a1a0c
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5              CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                         CO.jar;cfb994078ff4373c7e0f15de19830a3d
<NULL>                                                          Common.jar;a09b520288870aa3888194ce59179dbd

I have tried the below command

diff -y file1.csv file2.csv

But the below output is not as expected.

AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb                         AL.jar;d8c06ebedd7954681f34ab5c94fdc4fb
AR.jar;9a553dd203d0979aa60004e19cc98c12                       | AR.jar;4e6e584dd852684ba21ae63990e2a1a6
BI.jar;8022f6c5f83ba040394ff0b0a0323e8e                       | BV.jar;213d9df82095764702ef4929424a1a0c
BV.jar;f53c4a8c988aa8806b54063ebc682803                       | CaseUtilities.jar;5b787f1f3d57922bd980ebbfe9a5343e
CaseUtilities.jar;e5f653d899298f5e5d56f357b6f781c5            | CO.jar;cfb994078ff4373c7e0f15de19830a3d
CO.jar;b2f7a0ab6e646d6793631e5c97e05096                       | Common.jar;a09b520288870aa3888194ce59179dbd

Any idea how can my expected output be achieved!