On Sun, Feb 26, 2012 at 4:30 PM, lina <lina.lastn...@gmail.com> wrote:
> Hi,
>
> sorry a bit off-topic,
>
> sed -e 's/\(<[^ ]*>\)\([ ]*\)\(<[^ ]*>\)/\3\2\1/g'
> GNU Linux is cool
> Linux GNU cool is
No here ...

>
> I don't know why
>
> $ echo "GNU linux is cool" | sed -e 's/\(<[^ ]*>\)\([ ]*\)\(<[^ 
> ]*>\)/\3\2\1/g'
> GNU linux is cool
>
> It doesn't work.

Remove "<" and ">", from substitution, and sustitute * by "\+", and
you can use " *" without have to use "[ ]*"

sed -e 's/\([^ ]\+\)\( \+\)\([^ ]\+\)/\3\2\1/g'

or using extended regular expressions, you can remove all escape stuff :

sed -re 's/([^ ]+)( +)([^ ]+)/\3\2\1/g'

I hope this help


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CAL5yMZRQi7y3VH4bDqGtnEVeFdk0=lf5act3ggggpwdpin-...@mail.gmail.com

Reply via email to