[plug] Small problem with cut

Sawan Vithlani vithlani at westnet.com.au
Sun May 16 02:14:41 WST 2004


Hello All.

I have a small problem with using the cut utility:

I want to grab the pid of a certain process, so try this:

ps ux|grep "kdeinit: konqueror -session"

This gives me the whole process line, the second field of which is the pid as 
shown:

sawan     6460  0.3 11.8 77976 61448 ?       S    May14   7:08 kdeinit: 
konqueror -session 113ffb8855000108305114500000066510347_1084124886_479563

What option to I have to give to cut if I want to pipe the above to extract 
the second field of the line?

cut -b 11-16 seems to work but that will depend on the pid; a longer pid 
breaks it.

I know about pidof; cant seem to get it to match the process "kdeinit: 
konqueror -session". Same problem with pgrep.

Any help? even using some other utility.....

Thanks





More information about the plug mailing list