I tried to convert the jmeter .jtl file to csv file. Each line of jtl file contains the variables separated by commas as in normal csv file. For example: a,b,c,d,e,f However, in some of the lines there are multiple delimiter like comma(,) and comma inside quotation(","). For example : a,b,"c,d",e,f I could parse the comma separated value easily by reading the jtl file . But when I encounter comma inside quotation delimiter, by code fails to generate the useful result. I tried to use java multi split , but still the problem persists.
My java code is as follows :
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(new BufferedInputStream(new FileInputStream(new File("D:/apache-jmeter-2.11/apache-jmeter-2.11/bin/")))));
while((line = reader.readLine()) !=null){
String[] datas = line.split("[,\",\"]");
p.println(datas[0] + "," + datas[5] + "," + datas[2] + "," + datas[1] + "," + datas[3] + "," + datas[8] + "," + datas[9]);
}
I have used split to split using (,)and (","). How shoud i rewrite the code so that the problem could be solved.