title: running grep command in command line and from java code gives different results
body: <p>When I run the below grep command in terminal, I get the list of line numbers. But when i tried doing the same via java code i didn't any result. I am not sure what went wrong here.</p>
  
  <p>Thank in advance</p>
  
  <pre><code>grep -in "callback recieved" /home/local/ws/ui_auto/UIAutomator/result/test/logs | cut -f1 -d:
  
  
  public List&lt;Integer&gt; getLineNumbers(String pattern, String file, String pat) {
      String[] cmd = { "/bin/sh", "-c", "grep -in \""+ pattern + "\" " + file + " | cut -f1 -d:"}; // &gt; " + file + "_" + pat };
      System.out.println(cmd[2]);
      Process proc;
      List&lt;Integer&gt; rline = new ArrayList&lt;Integer&gt;();
      try {
          proc = Runtime.getRuntime().exec(cmd);
          BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
          String line;
          while ((line = bufferedReader.readLine()) != null) {
              System.out.println(line);
              rline.add(Integer.parseInt(line));
          }
      } catch (IOException e) {
          System.out.println(e);
      }
      return rline;
  }
  </code></pre>