Padmanabh Sahasrabudhe wrote:I only wish to see if the rows which file 1 has are all present in file 2 or not. I need not retain them. The contents of the two files should same row wise.
It's not yet clear from you explanation, but I suspect you have two separate problems here: row order and column order. The first is (probably) a simple sorting exercise, the other is a
mapping one, which supports Campbell's post.
For the latter, you will need some way of specifying the
new order for your columns.
The simplest way to do that in
Java is to supply column
indexes in the order that you want them output, so if you intend to supply column identifiers instead (which, I assume, is what 'A', 'B', 'C'...etc. are), then you will need some way of translating your "new column order" input into a set (or array) of indexes, and then using that to rearrange the output for each line.
It should be added that reading CSV files can be quite involved: It's not simply a case of splitting data based on commas (unless you're absolutely sure that's the case), so you might want to look at third party libraries for reading your files.
Alternatively, if this CSV is generated from an Excel spreadsheet, you might want to look at
Apache POI, because you may well be able to process it directly, rather than via CSVs.
HIH
Winston