我想从日志文件中提取一条信息。我使用的模式是节点名和命令的提示。我想提取命令输出的信息并进行比较。考虑如下示例输出
    NodeName > command1
    this is the sample output 
    NodeName > command2  
    this is the sample output
我已经尝试了以下代码。
public static void searchcommand( String strLineString) 
    {
             String searchFor = "Nodename> command1";
             String endStr = "Nodename";
             String op="";
             int end=0;
              int len = searchFor.length();
              int result = 0;
              if (len > 0) {  
              int start = strLineString.indexOf(searchFor);
              while(start!=-1){
      end = strLineString.indexOf(endStr,start+len);
              if(end!=-1){
                  op=strLineString.substring(start, end);
              }else{
                  op=strLineString.substring(start, strLineString.length());
              }
              String[] arr = op.split("%%%%%%%"); 
              for (String z : arr) {
                  System.out.println(z);
                }
                  start = strLineString.indexOf(searchFor,start+len);
              }
              }
    }
问题是代码太慢而无法提取数据。还有其他方法吗?
编辑 1 它是我在上面的代码中作为字符串读取的日志文件。