Date: Thu, 30 Oct 2008 15:14:13 +0100 From: Mel <fbsd.questions@rachie.is-a-geek.net> To: freebsd-questions@freebsd.org Cc: Eduardo Meyer <dudu.meyer@gmail.com> Subject: Re: Script-friendly (parseble) ps(1) output? Message-ID: <200810301514.13932.fbsd.questions@rachie.is-a-geek.net> In-Reply-To: <d3ea75b30810291502h716ae979r9906a7a053ec5f56@mail.gmail.com> References: <d3ea75b30810291502h716ae979r9906a7a053ec5f56@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 29 October 2008 23:02:43 Eduardo Meyer wrote:
> ps -ax -o pid -o user -o emul -o lstart -o lockname -o stat -o command
First of all you will want -ww, since the command will otherwise be truncated.
Secondly, you can comma seperate the -o arguments for brevity, so:
ps -awwx -o pid,user,emul,lstart,lockname,stat,command
will be your command.
You forgot to mention what language your CGI will be in, so I'll just give you
the simplest algorithm:
- read the first line
- record position of the first character after a space character, by simply
walking the line char by char
- Using those positional numbers it is now trivial to extract the information
from the rest of the lines.
--
Mel
Problem with today's modular software: they start with the modules
and never get to the software part.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810301514.13932.fbsd.questions>
