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

Re: [1/2OT] something about sed



On Monday 27,February,2012 12:16 AM, Allan Wind wrote:
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

It's an example from a book. I just clumsily wish to get some improvement by understanding some examples.


<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.

Thanks,

Best regards,


/Allan


Reply to: