Thank you for the reply. I really appreciate it. I will try that later
tonight. How would you save it to a file though, rather than system
clipboard? so like just to save it to some temporary new file named
temp.txt.





Christian Brabandt-3 wrote:
> 
> On Thu, June 10, 2010 5:33 am, fuzzylogic25 wrote:
>> I am new to Vim. I am trying to open a very large document and copy the
>> occurrence of a particular word in every line. So for example lets say
>> the
>> word "cat" appears 500 times in a 50,000 line document. I would like
>> those
>> 500 lines saved to a file somehow, or at least copied so I can somehow
>> save
>> it to a file.
>>
>> Is there a way of doing this in vim? or should i use c programming to do
>> it?
> 
> Try this:
> :let @a=""
> This clears register a. Then
> :g/cats/:y A/
> this appends all lines, that match cats into register a and
> then you have all matching lines in your register a.
> 
> You can then copy it for example into your systems clipboard using:
> :let @+...@a
> 
> or you can simply put it in a new buffer:
> :put a
> 
> 
> regards,
> Christian
> 
> -- 
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/search-for-occurrences-in-document-and-copy-it-tp28838398p28840544.html
Sent from the Vim - General mailing list archive at Nabble.com.

-- 
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

Reply via email to