pick values based on name from ps -ef output

I need to collect two columns based on the values from "ps -ef |grep" command output . In our organization users are trying starting pgbouncer with different command and options. my requirement is to to pick pgbouncer binary and its configuration file

here is the example :

[root@sl273pgb01 pavan]# ps -ef |grep pgbo
pgbounc+   1655      1  0 Jan11 ?        00:15:05 /usr/bin/pgbouncer -d -q /etc/pgbouncer1/pgbouncer.ini
pgbounc+   1678      1  0 Jan07 ?        00:15:05 /usr/bin/pgbouncer  /etc/pgbouncer2/pgbouncer.ini -d -q
pgbounc+   1699      1  0 Jan09 ?        00:15:05 /usr/bin/pgbouncer -d   /etc/pgbouncer3/pgbouncer.ini -R

OP's efforts:

ps -ef |grep pgbo |awk '{print $ 7 " " $8}'

from the above output, in need to get output as below

/usr/bin/pgbouncer  /etc/pgbouncer1/pgbouncer.ini
/usr/bin/pgbouncer  /etc/pgbouncer2/pgbouncer.ini 
/usr/bin/pgbouncer  /etc/pgbouncer3/pgbouncer.ini 

please help me how can I get desired output.

Read more here: https://stackoverflow.com/questions/65708540/pick-values-based-on-name-from-ps-ef-output

Content Attribution

This content was originally published by Durga at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: