Vim: Capturing search results
You can capture the search results from the :g/ command in Vim into a register for later use:
:redir @a --capture search results in register a :g/my search string --execute search :redir END --turn off capture :new --create a new document :put! a --paste contents of register a into new document