[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kill with regex?



On Mon, 2003-01-20 at 10:41, Hugh Saunders wrote:
> On Mon, Jan 20, 2003 at 10:22:13AM +1100, Michael Wardle wrote:
> > On Mon, 2003-01-20 at 02:40, Hugh Saunders wrote:
> > > ps x gives a list of xine's which i would like to kill
> > 
> > My preferred method is:
> > $ kill `ps -C xine -o pid=`
> > OR
> > $ ps -C xine -o pid= | xargs kill
> > 
> that makes sense, this is my understanding: 
> -C means command name, -o defines the desired format
> of the ps output and xargs uses whatever is piped to it as the
> argument for kill?

Yes, "-C" matches processes named "xine" (and apparently any process
whose name begins with "xine"), "-o pid=" means show a list of process
IDs without a header line, the backquotes insert the output of the shell
command, and xargs passes its arguments read from the pipe to the
command named as its first parameter.  (Just like you said.)

I don't like using sed or awk unless I have to. :-)

-- 
Michael Wardle <michael.wardle@adacel.com>
Adacel Technologies



Reply to: