:redir @* |g/cat/sil! -3,+4 |redir END | redir >> results.txt
Such solution will find all lines where "cat" is mentioned and copy a block of lines starting from 3 lines above and 4 lines below. The result is placed into a file named "results.txt". I like one liner solutions and this works faster on larger files.
--
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
No comments:
Post a Comment