- Why you do not want use regular expression to skip rows which are not related to devices info?
- And then you just can skip lines which contain '-'
And you will have only real devices.
You can use method below to parse every line of output:
private void parseToDevice(String line) {
Pattern pattern = Pattern.compile("((.{0,})\\((.{0,})\\)\\s{0,}\\s\\[(.{0,})])|(((.{0,})\\((.{0,})\\))(\\s-*\\s*(.*)))|((\\w+ \\w+ -)(\\s-*\\s*(.*)))|((\\w*\\s\\-)(.*))");
Matcher matcher = pattern.matcher(line);
String UUID = "";
if(matcher.find()) {
UUID = matcher.group(4);
if(!line.toLowerCase().contains("simulator") && !UUID.contains("-")) {
PARSE REAL DEVICE INFO HERE AS YOU WISH
}
}
}