From owner-freebsd-stable@FreeBSD.ORG Thu Oct 30 00:53:07 2008 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83A0F106567F for ; Thu, 30 Oct 2008 00:53:07 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id 426A88FC0A for ; Thu, 30 Oct 2008 00:53:07 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r55.edvax.de (port-92-195-52-25.dynamic.qsc.de [92.195.52.25]) by mx01.qsc.de (Postfix) with ESMTP id 9B7D150D49; Thu, 30 Oct 2008 01:37:22 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id m9U0bLRe003520; Thu, 30 Oct 2008 01:37:21 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Thu, 30 Oct 2008 01:37:20 +0100 From: Polytropon To: "Eduardo Meyer" Message-Id: <20081030013720.1ea2c825.freebsd@edvax.de> In-Reply-To: References: Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: stable@freebsd.org, questions@freebsd.org Subject: Re: Script-friendly (parseble) ps(1) output? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2008 00:53:07 -0000 On Wed, 29 Oct 2008 20:02:43 -0200, "Eduardo Meyer" 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("%s%s%s%s%s\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, ...