[lug] Regex from shell

Jason Davis mohadib at openactive.org
Thu Nov 18 23:35:33 MST 2004


On Thu, 2004-11-18 at 22:42, Chip Atkinson wrote:
> One thing you could try is 
> 
> for i in 0 1 2 3 4 5 6 7 8 9; do
>   kill 111${i}
> done
> 
> There are probably other ways that are more efficient though.  
> 
> Chip
> 
> On Thu, 18 Nov 2004, Budyanto Himawan wrote:
> 
> > Hi,
> > 
> > Is there a way to specify a shell command mixed with
> > regular expression?
> > 
> > for example I want to kill all processes with pids 
> > 1110 to
> > 1119
> > 
> > I want to do something like "kill 111[0-9]".
> > I tired a few different combo of the above and none
> > seems to work. I know there must be something like
> > that cause I used to know it but I just can't seem to
> > recall.

perl -e 'for(4529..4533){`kill -9 $_`;}'

this would kill all pids fro, 4529 to 4533

Thanks,
Jason Davis
mohadib at openactive.org
~
Helen Sinclair: No, no, don't speak. Don't speak. Please don't speak. Please don't speak. No. No. No. Go. Go, gentle Scorpio, go. Your Pisces wishes you every happy return.
David Shayne: Just one...
Helen Sinclair: Don't speak. 




More information about the LUG mailing list