Glassfish - Obtain Name & PID and format output
I want to get the pid for each domain, nodeagent and application running in glassfish. I then need to format that data to enable ease of reading. Here is what I have thus far for the domain only but it does not work. I can get the PID to display but I need it formatted.
Code: #!/bin/bash sudo find /opt/SUN/SUNAppSrv -name .__com* | grep domain > /tmp/pid_domain #echo $1 List="$(cat /tmp/pid_domain)" echo 'List' "$List" for strng in "$List"; do echo 'in the loop' awk -F '/' '{ print $7 }' $strng cat $strng > pid BEGIN { FS= "/" #make tab the field separator printf("%15s %5s", "Name" , "PID") } { printf("%15s %6d", $1 $pid } END { printf("\n%15s %6d") } done echo 'COMPLETED' Want output to look like: Name PID DomainName pid Here is what I get: List /opt/SUN/SUNAppSrv/9.1.01/domains/PCTestDomain/config/.__com_sun_appserv_pid ./pidglean.sh: line 16: syntax error near unexpected token `"%15s %5s",' ./pidglean.sh: line 16: ` printf("%15s %5s",' I know this is pretty site specific. Any help with the code would be great. I'm just really unfamiliar with awk but wanting to learn more about it. Thank you. |
The printf statement in awk does not requires parentheses. A correct form is
Code:
printf "%15s %5s","Name","PID" Code:
awk ' |
All times are GMT -5. The time now is 03:25 AM. |