try {
Process child = Runtime
.getRuntime()
.exec(
new String[] {
"/bin/sh",
"-c",
"grep 'sth' xx.log|cut -d ' ' -f6,1|sort |uniq -c |sort" },
null,
new File("path"));
BufferedReader in = new BufferedReader(new InputStreamReader(child
.getInputStream()));
String c = null;
while ((c = in.readLine()) != null) {
System.out.println(c + "<br/>");
}
child.waitFor();
in.close();
} catch (Exception e) {
e.printStackTrace();
System.out.print(e.getMessage());
}