On 06/09/2010 10:33 PM, fuzzylogic25 wrote:
Hi,
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?
In addition to the other good answers you've already gotten:
:g/cat/.w! >> out.txt
should dump every match to a file (if the file out.txt
pre-exists, it appends)
:help :w_a
-tim
--
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