Help extracting process name from ps command AIX using KSH

Hi All,

Newbie script writer and I need some help!

I'm grepping ps - eno THREAD >outfile

This gives me loads of stuff including the proc names which appear at the end of the line. They're all 10 characters long so what I want to do is cut them (and only them) from the file and put it in another file. The proc names all start with JN then there's another 8 characters after that. There's also a space before each procname. I tried using awk and substr but couldn't get it to work!

Any help much appreciated

Cheers

try using this command ps -ef args > /tmp/outfile.out this will only give you the arguements and there will be no need to get rid of the rest of the stuff you are referring too.

The command is not even valid!

Cheers

ps -ef | grep "JN[A-Za-z]\{8\}"

Post the output of:

ps - eno THREAD

and the desired output.

/ksh -x /powercenter/controlm/produser/lib/VAT/batchrun.sh 20100812 JNVT50001023
/ksh -x /powercenter/controlm/produser/lib/VAT/batchrun.sh 20100812 JNVI40001087

etc. There's usually about 30 of them. On the aix shell the jobname starts one space after the date but this window won't allow me to do that. Either way it's the last 'word' from the ps command.

Cheers

Something like this?

ps - eno THREAD | awk '{print $NF}'

Cheers that's a great help. The ouput still has some other junk in it I don't want but I'll try and work out how to get rid of that!