views:

28

answers:

2

When I do the following

ps -aef|grep "asdf" 

I get a list of processes that are running. Each one of my process has the following text in the output:

-ProcessName=XXXX

I'd like to be able to format the out put so all I get is:

The following processes are running:
Process A
Process B
etc..
A: 

you can format your ps output using -o eg

ps -eo args| awk -F"=" '/asdf/{print $2}'
ghostdog74
+1  A: 

Use sed(1):

... | grep "asdf" | sed -e 's:.*-ProcessName=\([^ ]\+\).*:Process \1:'
Aaron Digulla