I m trying to write code to merge two csv files. could any one help me out to get the hints to start?
Not enough info. Merge by concatenation, by joining records in input order, by joining based on a key value present in both files? Etc?
Formats or examples of both files, and how are they to be merged (or an example output file) would be really helpful here.
I'm sorry for that.
Here are the example files,
1st file looks like:
sno,first name,last name
2nd file looks like:
sno,first name,last name,place
OK, no problemo.
Are you looking for a quick'n'dirty way or a good Java object-oriented way?
for time being I need a quick way
Read each file into a map (2 files, 2 maps) by extracting the sno to use as key, and put the rest of the line as the value.
When you have the two maps look through all the keys in the first map, and get the corresponding values from both maps. For each key concatenate the key with both values and write that to the output file.
I'm sorry, I m very beginner. Could u explain more plz :-(