On Wednesday, April 9, 2014 2:09:05 PM UTC+4, natercia wrote:
> Hi,
> 
> 
> 
> In a file with many occurrences of something like this:
> 
> 
> 
> \xxx{a variable number of words that I want to delete}{a variable (diferent) 
> 
> number of words that I want to keep}
> 
> 
> 
> I would like to eliminate at once in all occurrences in the file the 
> following:
> 
> \xxx
> 
> the two pairs of {}
> 
> the content of the first {} independently of its size (which can be different 
> 
> from occurrence to occurrence)
> 
> 
> 
> That is, I want to keep only the content of the second pair of {} above.
> 
> In this case, I would like to obtain:
> 
> a variable (diferent) number of words that I want to keep
> 
> 
> 
> \xxx{argument 1}{argument 2} can exist more than once in a line, but never 
> 
> will exist a \xxx in the arguments of another \xxx.
> 
> 
> 
> If "argument 1" and "argument 2" were kept in all occurrences, I could solve 
> 
> my problem with something like this:
> 
> :1,$ s/\\xxx{argument 1}{argument 2}/argument 2/g
> 
> but my problem is that argument 1 and argument 2 are different from 
> occurrence 
> 
> to occurrence.
> 
> Don't know if this info is needed or not: both argument 1 and/or argument 2 
> 
> can contain the symbols \ {}.
> 
> 
> 
> Can someone help me?
> 
> 
> 
> Thank you very much,
> 
> Natércia

sometimes it's better to use sed or awk

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to