My Text file Contains line like this
FLTR TID: 0000003756 RPC ID: 0000108159 USER: Remedy Application Service
FLTR TID: 0000003756 RPC ID: 0
ArrayList
add whenever new UserName appears add and before that check whether user exist in arrayList or not (by the Use of contains("UName")
) and than proceed.String username=line.substring(line.lastindexOf(":")).trim();
or You can use line.split(":")[1].trim();
For Excel row creation you can use loop.
int i=0;
while((str=br.readLine())!=null){
row = sheet.createRow((short) i);
cell = row.createCell(i);
cell.setCellValue("UserName");//Set UserName after getting it from 'str'
i++;
}