From owner-freebsd-stable@FreeBSD.ORG Thu Oct 30 14:59:44 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 E52E21065696 for ; Thu, 30 Oct 2008 14:59:44 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (gizmo.acns.msu.edu [35.8.1.43]) by mx1.freebsd.org (Postfix) with ESMTP id A8C618FC1C for ; Thu, 30 Oct 2008 14:59:44 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (localhost [127.0.0.1]) by gizmo.acns.msu.edu (8.13.6/8.13.6) with ESMTP id m9UEf0g8012284; Thu, 30 Oct 2008 10:41:00 -0400 (EDT) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: (from jerrymc@localhost) by gizmo.acns.msu.edu (8.13.6/8.13.6/Submit) id m9UEf0v8012283; Thu, 30 Oct 2008 10:41:00 -0400 (EDT) (envelope-from jerrymc) Date: Thu, 30 Oct 2008 10:41:00 -0400 From: Jerry McAllister To: d@delphij.net Message-ID: <20081030144100.GA12264@gizmo.acns.msu.edu> References: <4908EE91.1080706@delphij.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4908EE91.1080706@delphij.net> User-Agent: Mutt/1.4.2.2i Cc: stable@freebsd.org, Eduardo Meyer , 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 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 14:59:45 -0000 On Wed, Oct 29, 2008 at 04:15:29PM -0700, Xin LI wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Eduardo Meyer wrote: > > Hello, > > > > 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. > > > > I need to add one ps information per column in a table (html), > > however, I found ps(1) output to be too hard to parse. There is no > > separator. I believed \t was the separator but its not. > > > > The ps(1) command I need to use is: > > > > ps -ax -o pid -o user -o emul -o lstart -o lockname -o stat -o command > > > > Since many of those args use [:space:] in the output, I can not use > > [:space:] as a separator. > > Sadly, `-o fiend='value'` will only format the HEADER output, not the values. > > > > Ive got no clue what to do, can someone enlight me? Well, first pick a language. This would be easy in PHP or Perl or other similar scripting interpreter languages. If you pick one and then study it a little - write a few simple practice scripts, you will probably quickly see how to do it. ////jerry > > Perhaps use cut(1) with -c or something similar in other scripting > language? It looks like that the output is aligned. > > Cheers, > - -- > Xin LI http://www.delphij.net/ > FreeBSD - The Power to Serve! > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.9 (FreeBSD) > > iEYEARECAAYFAkkI7pEACgkQi+vbBBjt66Bi3wCgmk9chU/FIZjuBpm/57Yl7jBY > D6kAoI6ZmQRdxDm7mzjale84p4uXmlmz > =4FMM > -----END PGP SIGNATURE----- > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"