Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ozaz

macrumors 68000
Original poster
I have a large text file (thousands of lines). I want to find all the lines that contain a particular phrase (of which there are many) and copy them to another file. Any text editor will search for the phrase but all the ones I use go to each instance of the phrase one-by-one. I'd like the result of the search to be the display of all the lines that contain the phrase (i.e hiding the lines that don't contain the phrase).

Can anyone advise me on an app that will do this?

Thanks
 
Last edited:
Wirelessly posted (Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3)

Grep is built in and available from Terminal.app and will do exactly what you want.

B
 
Thanks for telling me about grep.

I have just found a way to do this without terminal. TextWrangler has a feature called "process lines containing.." (in the Text menu).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.