I want to remove the the 2nd and 3rd column from a csv file but don't know how to. My current code is like this:
BufferedReader br = new BufferedReader(new FileReader(dir + file));
BufferedWriter bw = new BufferedWriter(new FileWriter(target + file));
String perLine;
while ((perLine = br.readLine()) != null) {
Code to remove the 2nd and 3rd column...
bw.write(perLine)
}
br.close();
bw.close();
Data is something like this:
1,abc,2,def,data,data,1,2,3,4,5
2,wxyz,32,abc,data,data,1,2,3,4,5
Want to achieve this:
1,def,data,data,1,2,3,4,5
2,abc,data,data,1,2,3,4,5
Is this possible without adding any csv lib or just doing regex? anyone can give me an idea or example?