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

Re: [1/2OT] something about sed



On 2012-02-26 23:30:55, lina wrote:
> $ echo "GNU linux is cool" | sed -e 's/\(<[^ ]*>\)\([ ]*\)\(<[^ ]*>\)/\3\2\1/g'
> GNU linux is cool

What is it that you are trying to do?  The regex is looking for 

<optional non-space>optional space<optional non-space>

and as there are no <> in the input nothing matches.  The -n 
argument to sed quite useful to see this in which case you use 
the p command to print what matches.


/Allan
-- 
Allan Wind
Life Integrity, LLC
<http://lifeintegrity.com>


Reply to: