I'm trying to use awk to parse an output generated by a java application, but it isn't working. It seems that the command after the pipe isn't able to get/see the data throwed by the java app.
I'm executing the following command (with the return generated by the command):
[root@localhost]# java -jar jmxclient.jar usr:pass host:port java.lang:type=Threading ThreadCount
06/11/2010 15:46:37 -0300 org.archive.jmx.Client ThreadCount: 103
What I need it's only the last part of the string. So I'm tryng to use awk (with pipe at the end of the line |awk -F ':' '{print $4}'
:
[root@localhost]# java -jar jmxclient.jar usr:pass host:port java.lang:type=Threading ThreadCount|awk -F ':' '{print $4}'
But the output isn't being parsed. It throws the entire string: 06/11/2010 15:46:37 -0300 org.archive.jmx.Client ThreadCount: 103
I also tryed to use |cut -f4 -d":"
with the same result: the string isn't parsed.
So my question is, how do I parse the output in order to get just the number at the end of the string?
TIA,
Bob
Like Ignacio Vazquez-Abrams said, it's probably going to stderr. As well, there's an awk trick that will make your life easier:
$NF
, which is the last field. Thus, I would do something like this:The log is probably being output to stderr.
Instructions for bash