[plug] Small problem with cut

James Devenish devenish at guild.uwa.edu.au
Sun May 16 08:53:54 WST 2004


Hi,

In message <200405160348.08187.mike at gilks1.com>
on Sun, May 16, 2004 at 03:48:08AM +0800, J Michael Gilks wrote:
> ps aux | grep "kdeinit: konqueror -session" | cut -f 6 -d " "
> should give the result you are after.

I suggest that these are more robust (unless I've made typos):

ps auxw | fgrep 'kdeinit: konqueror -session' | awk '{print$2}'

(I.e. use awk instead of cut.)

pgrep -f konqueror

(This is a frequently asked question on this list.)

The only thing to watch out for in all the above cases is whether you
are matching processes that belong to users other than yourself. This
may or may not be relevant to your situation, and probably has no
practical impact unless you strictly need only a single PID to be
returned.





More information about the plug mailing list