Andreas Bernauer wrote: > Sean wrote: >> For example, I have a text file in which >> there are a lot of expressions in the following form: >> >> id = number >> >> id: [a-z]+ >> number: [0-9]+ >> >> I want to rewrite these expressions into this form >> >> (set id number) >> >> is it possible to do this in vim? > The command you're looking for is > :s/\(\l\+\)\s*=\s*\(\d\+\)/(set \1 \2)/
Or, with less backslashes, using 'very magic' (the \v switch): :s/\v(\l+)\s*\=\s*(\d+)/(set \1 \2)/ -- Andreas. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
