vim - vi search copy paste search copy -


I was just thinking that anyone could help how to do the following using vi.

I is a text file and it can be in some way

  beginning of the text file: --something1.something2-- --anotherThing1.something2--text End of file:  

If I want to take this line and it matches any of the first occurrence of [a-za-z0-9] If you try to change it through search of the thing, then copy the buffer and add it first on the same line before the first row -

  start of the text file: --something1.something2. Something1- --- anotherThing1.something2.anotherThing1-- End of the text file:  

Is there a sixth order to do this?

Cheers Ben

 :% s / - \ ([a] -zA-Z0- 9] * \). \. (. * \) - / - \ 1. \ 2 \ / P> 
 :% s / - \ ([a-zA-Z0- 9] * \). \ (. * \) - / - \ 1. \ 2. \ 1 - / g  

will be generated:

  - something1.something2.something1 From ------ >  

This is when you want to copy the first word after 'till first'. 'Add more'. ' Re-comments:

Someone has mentioned that this will happen when there are many words, then do not work. I tested this on:

  Start of the text file: --something1.something2.something3.something4.something5.something6----otherothering.Soething2.anotherThing3.anotherThing4.anotherThing5- - End of the text file:  

Replace with the above expression:

  Beginning of text file: --something1.something2.something3.something4.something5. Some 6.something1-- -Anthrthyping 1.something2.anotherThing3.anotherThing4.anotherThing5.anotherThing1-- End of the text file:  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -