I am running following unix command using ProcessBuilder and it is working fine.
String[] commands = {"egrep","search string","fileName"}
ProcessBuilder pb =...
Now I have an additional requirement to filter the output.
String [] commands = {"egrep","search string","fileName","|","awk\'$0 >\"time\" && $2==\"INFO\"\'"}
I am getting error "IO Exception: No such file error". It seems it is considering pipe(|) and other awk command as file.
I also tried adding prefix "bash -c" or "/bin/sh -c" like
String [] commands = {"bash","-c","egrep","search string","fileName","|","awk\'$0 >\"time\" && $2==\"INFO\"\'"}
Now I am getting error "bash -c line0: syntax error near unexpected token 'is'bash:-c line0:"
I also tried giving entire egrep command in single string but it also didn't work.
Please advice what am I missing error to use pipe for filtering the output.