Date: Thu, 30 Oct 2008 01:37:20 +0100 From: Polytropon <freebsd@edvax.de> To: "Eduardo Meyer" <dudu.meyer@gmail.com> Cc: stable@freebsd.org, questions@freebsd.org Subject: Re: Script-friendly (parseble) ps(1) output? Message-ID: <20081030013720.1ea2c825.freebsd@edvax.de> 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 Wed, 29 Oct 2008 20:02:43 -0200, "Eduardo Meyer" <dudu.meyer@gmail.com> wrote:
> I need to write a cgi script which will print the output from ps(1) in
> a table (html), so the average-operator can click on a KILL link and
> the cgi will send the selected signal.
If you can use awk, it's quite simple:
ps | awk -F " " 'NR > 1 {printf("<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td>\n", $1, $2, $3, $4, $5);}'
The only problem I see is that $5, the COMMAND field, is truncated
after the first space character, so command line arguments will be
missing.
--
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081030013720.1ea2c825.freebsd>
