Ps -fea | grep pmon

hello
when a write this code

[oracle9i]$ ps -fea | grep pmon

result:

    root  1515     1  0  Feb  9  ?         0:10 ipmon -sD
oracle9i 18357     1  0  Feb  9  ?         1:04 ora_pmon_db1_PROD
oracle9i 22830     1  0  Feb  9  ?         0:17 ora_pmon_db2_PROD
oracle9i 22859     1  0  Feb  9  ?         0:14 ora_pmon_db3
oracle9i  5087  3003  1 15:26:44 pts/6     0:00 grep pmon

how to get this result

db1_PROD
db2_PROD
db3

Help please

Try this:-

pgrep -fl _pmon_ | sed 's#.*_pmon_##'

hi yoda

this is result

pgrep -fl _pmon_ | sed 's#.*_pmon_##'
/usr/bin/ksh: pgrep:  not found

=(
OS HP-UX

Just using standard utilities, you could also try:

ps -fea | grep '[_]pmon[_]' | while read -r line
do	printf '%s\n' "${line##*_pmon_}"
done
1 Like

Hello Don Cragun,

its Works

thanks!