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

Re: [Sheflug] Little script help




I'm assuming you still have the option to 'ps' to allow it to produce
a full commandline, rather than simply the command name. Basically,
you can pipe it through 'awk' with a 'print $6' on the command line,
and then do something like 's/\/tmp\///' to strip off the '/tmp/' bit.
A really dirty command line would look like:

ps -A e | grep 'cat /tmp/' | awk 'print $6' | sed -e 's/\/tmp\///'

You might want to modify the 'grep' command to do a more selective
type of search.

A.D.

On Mon, Nov 27, 2000 at 02:27:40PM +0000, José Luis Gómez Dans wrote:
> Hi!
> 	I was just wondering whether anyone can give me a hand with a
> little script using sed or awk. Simply what I want to do is to search
> for a strig in a kernel 2.0.36 lists of processes (that string being a
> the name of a process that follows a given pattern, i.e., "cat
> /tmp/$something [...]"). Also, it'd be nice to get the $something bit
> off the process name.
> 
> 	I tried parsing the output of ps (it's easy if you fiddle about
> its options), but since this is for a mulinux server, ps is a hacked
> together veresion of it, which doesn't have most of the options that
> allow for an idiot's script. :-)
> 
> 	Thanks,
> 	José
> -- 
> José L Gómez Dans			PhD student
> Tel: +44 114 222 5582			Radar & Communications Group
> FAX; +44 870 132 2990			Department of Electronic Engineering
> 					University of Sheffield UK
> ---------------------------------------------------------------------
> Sheffield Linux User's Group - http://www.sheflug.co.uk
> To unsubscribe from this list send mail to
> - <sheflug-request [at] vuw.ac.nz> - with the word 
>  "unsubscribe" in the body of the message. 
> 
>   GNU the choice of a complete generation.
> 
> 
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word 
 "unsubscribe" in the body of the message. 

  GNU the choice of a complete generation.