in reply to Reaped: How to copy certain statements alone to new text file?
There is already another thread from OP for the same query.