Hi I am trying to fetch specific data from .csv file and the code i used is
import java.io.BufferedReader;
import java.io.FileReader;
public class InsertValuesIntoTestDb {
public static void main(String[] args) throws Exception {
String splitBy = ",";
BufferedReader br = new BufferedReader(newFileReader("test.csv"));
String line = br.readLine();
while ((line = br.readLine()) !=null) {
String[] b = line.split(splitBy);
System.out.println(b[0]);
}
br.close();
}
}
and the .csv looks like
a,f,w,b,numinst,af,ub
1RW,800,64,22,1,48:2,true
1RW,800,16,39,1,48:2,true
1RW,800,640,330,1,48:2,true
1RW,800,40,124,1,48:2,true
1RW,800,32,104,1,48:2,true
1RW,800,8,104,1,48:2,true
1R1W,800,65536,39,1,96:96,true
1R1W,800,2048,39,1,96:96,true
1R1W,800,8192,39,1,48:48,true
with the above code i can print only column 'a' and my o/p looks like
a
1RW
1Rw
1Rw
like this but how can i print column f,w,b ??
my output should look like
f w b
800 64 22
800 64 22
800 64 22
Thanks