I'm trying to write a little diagnostic tool and one of the functions I want from it is that I want to run is: ps axu | grep tomcat | grep -v grep | awk '{ print $<list of desired fields> }'  I want to return the userid that started tomcat and the following parameters that were passed when tomcat started:-javaagent:/usr/share/tomcat7/<someagent> -Dcatalina.base=/var/lib/tomcat7 - Dcatalina.home=/usr/share/tomcat7 -Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmpI want those fields passed into an array which I can then use to tell the user something about the tomcat install.  The problem is I can't find a way of formatting the command to force the fields to be what I need them to be to make awk work.  At this point I'm thinking of just taking the output, writing it to a temp file, then pulling what I want out using regex.  I know there's a way to do this in Bash but I have not had any success getting there from here. 
Extract tomcat parameters from ps output
shell script;text processing;ps