CSV file comparison


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CSV file comparison
# 1  
Old 06-20-2011
CSV file comparison

Hi all,

i have two .csv files. i need to compare those two files and if there is any difference that should be moved into third .csv file.

example,

org.csv and dup.csv


when we compare those two files org.csv and dup.csv. if there is any change in dup.csv. it should be capture in third file .

please help me on this.

thanks in advance...
baski
# 2  
Old 06-20-2011
What those files look we dont know unless you post a sample of org.csv and dup.csv.
# 3  
Old 06-20-2011
Are they in the same order? Will they ever have different numbers of lines? A simple solution for line-matching might just be:

diff a.csv b.csv | grep '^> ' | sed 's/> //' > diff-file
This User Gave Thanks to Corona688 For This Post:
# 4  
Old 06-20-2011
Hi,

it has contain 51 colums.. with same order only..

actually i have 2 xml file and i m converting those xml files into csv. to compare those files.

it contains large data so i unable to post it..

thanks corona .. let me try that on.. but i need the difference should in .csv format


Thanks,
baski
# 5  
Old 06-21-2011
Hi frnds,

Please help me out on the above issue..

thanks,
baski
# 6  
Old 06-21-2011
The output was in CSV. Have you tried it to see if it does what you want?
# 7  
Old 06-21-2011
Try this:
Code:
grep -F -v -f CSV1 CSV2

It presumes sorted data and CSV2 file is with more lines.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Save output of updated csv file as csv file itself, part 2

Hi, I have another problem. I want to sort another csv file by the first field. result.csv SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw /home/intannf/foto5/2015_0313_090651_219.JPG,0.,-7.77223,110.37310,30.75,996.46,148.75,180.94,182.00,63.92 ... (2 Replies)
Discussion started by: refrain
2 Replies

2. Shell Programming and Scripting

Save output of updated csv file as csv file itself

Hi, all I want to sort a csv file based on timestamp from oldest to newest and save the output as csv file itself. Here is an example of my csv file. test.csv SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0739.JPG,2015:02:17 11:32:21 /home/intannf/foto/IMG_0749.JPG,2015:02:17 11:37:28... (10 Replies)
Discussion started by: refrain
10 Replies

3. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

4. Shell Programming and Scripting

Match columns from two csv files and update field in one of the csv file

Hi, I have a file of csv data, which looks like this: file1: 1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628 2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Discussion started by: djoseph
10 Replies

5. Shell Programming and Scripting

Compare 2 csv files in ksh and o/p the difference in a new csv file

(say) I have 2 csv files - file1.csv & file2.csv as mentioned below: file1.csv ID,version,cost 1000,1,30 2000,2,40 3000,3,50 4000,4,60 file2.csv ID,version,cost 1000,1,30 2000,2,45 3000,4,55 6000,5,70 The... (7 Replies)
Discussion started by: Naresh101
7 Replies

6. Shell Programming and Scripting

csv file comparison with normal file

i will like to give my files as fileB : 02.09.2011:MOU04/KUBIS--R_Lieferung_1/KUBIS_V15.0/vpn_wls_15-0-0b01 02.09.2011:MOU04/KUBIS--R_Lieferung_2/KUBIS_V15.0/apng_wls_15-0-0b02 31 02.09.2011:MOU04/KUBIS--R_Lieferung_2/KUBIS_V15.0/ecc_wls_15-0-0b02 32 ... (2 Replies)
Discussion started by: rajniman
2 Replies

7. Shell Programming and Scripting

csv 4 columns values comparison!

Hi all, i have a csv file which as the following data: 294;F03;2000;40441 294;F03;2000;40443 284;F01;5400;44051 284;F01;5700;45666 the file holds 11689 lines. I was trying to get a script running to output results from this file that for each line with the condition: if a line is found... (9 Replies)
Discussion started by: stryng
9 Replies

8. Shell Programming and Scripting

Need to compare two csv files values and write into another csv file

Hi all, Am new to scripting. So i just need your ideas to help me out. Here goes my requirement. I have two csv files 1.csv 2.csv abc,1.24 abc,1 def,2.13 def,1 I need to compare the first column of 1.csv with 2.csv and if matches then need to compare... (2 Replies)
Discussion started by: chinnahyd
2 Replies

9. Shell Programming and Scripting

Need help on comparison of two csv files

Dear All, I want to compare two csv files using shell programming - File 1 contents 44,,NONE,0,,2/2/1901 66,,NONE,0,,2/3/1901 File 2 Contents 1022,3708268,AUFX,0,100919,3/1/2006 66,,NONE,0,,2/3/1901 After comparing each column/field I want to print the occurances of... (5 Replies)
Discussion started by: sourav1982
5 Replies
Login or Register to Ask a Question