[plug] Small problem with cut

J Michael Gilks mike at gilks1.com
Sun May 16 02:49:21 WST 2004


cut -f 2
should do it. Fields are numbered from 1, just to confuse people who are 
thinking arrays, and default field delimiter is whitespace. This of course 
makes extracting the date messy.

Love
Mike.

On Sun, 16 May 2004 02:14 am, Sawan Vithlani wrote:
> 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
>
>
> _______________________________________________
> PLUG discussion list: plug at plug.linux.org.au
> http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au



More information about the plug mailing list