Re: OT Regular Expression [grep]

From: Date: Tue, 03 Apr 2001 20:53:02 +0000
Subject: Re: OT Regular Expression [grep]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-46894@lists.php.net to get a copy of this message
Thanks! On 4/3/2001 4:41 PM this was written: > On Tuesday 03 April 2001 21:59, you wrote: > >> I would like to find all processes by a given user on a linux box and >> kill them. I know this much: >> >> ps -u username >> >> Now, do I then pipe that to grep somehow and get just the PID's? > > (1) look up system / backtick operator / ... to get the output of the > grep call as array, one line per entry > > (2) do a > > foreach ($TheOutput as $Line) { > if (preg_match ('/^\s*(\d+)/', $Line, $Matches)) { > $PID = $Matches [1]; > // kill it > } > } -- Thomas Deliduka IT Manager ------------------------- New Eve Media The Solution To Your Internet Angst http://www.neweve.com/

« previous php.general (#46894) next »