On 31/12/08 05:23, the.dude wrote:
> hi,
> i want to swap words in the following way. original text is
>
> a = b
> daf = dfgdf
> a+b*c = d+e*f
> ab(bc)+{adf} = dfdsf+343=fdf
>
> i want to modify the above text as
>
> b = a
> dfgdf = daf
> d+e*f = a+b*c
> dfdsf+343=fdf = ab(bc)+{adf}
>
> how can this be done in easiest way in vim.
>
> --
> the.dude
:%s/\(.*\)\( = \)\(.*\)/\3\2\1
meaning: whenever a line includes the following three parts:
- zero or more of anything, as many as possible
- space, equal, space
- zero or more of anything, as many as possible
replace them by the same thee parts in the opposite order
see
:help :s
:help patterrn-overview
Best regards,
Tony.
--
An exotic journey in downtown Newark is in your future.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---