Stupid regex question

kevin_d_clark at comcast.net kevin_d_clark at comcast.net
Thu Mar 2 16:05:47 EST 2006


> pardsbane $ echo "this is a -p param test" | sed -e 's/.*\-p \([a-z]* 
> \).*/\1/'
> param
> pardsbane $ echo "this is a param test" | sed -e 's/.*\-p \([a-z]* 
> \).*/\1/'
> this is a param test
> 
> I would like to modify the search so that in the latter case, nothing  
> is returned. 

This does what you ask for:

   sed -n '/-p/p'

Regards,

--kevin
-- 
GnuPG ID: B280F24E



More information about the Discuss mailing list