How about:

ps -f -p pid  |  tail -n1 | awk '{print $1 $2 $5 $7}'

Hope it helps,

Ahbaid.

linda hanigan wrote:

> Hi all,
> I am using a system call to ps in a program I am writting.
> I am using:
> ps -f -p pid
> The output is
> UID        PID  PPID  C STIME TTY          TIME CMD
> general  16661 16660  0 17:34 pts/0    00:00:00 -bash
>
> I would like the output to be
> general  16661 17:34   -bash
>
> I can of course work with the output to make it look like
> I want.  However I was wondering if their was a way
> ps would allow me to select which fields I want to show.
> I know ps h -f -p pid  will get rid of the header.
>        Thanks
>        Linda Hanigan
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to