I have a giant file with thousands of lines, I want to delete only the lines which have the word "Foo" in them.
How would I go about doing this? I'm on a Mac, so I could use some command line utility, but I'd prefer to use TextWrangler.
|
I have a giant file with thousands of lines, I want to delete only the lines which have the word "Foo" in them. How would I go about doing this? I'm on a Mac, so I could use some command line utility, but I'd prefer to use TextWrangler. | ||||
|
feedback
|
|
Most graphical programmer's editors do not allow you to delete lines like this, but only change their contents. This can be done by replacing If you're willing to look towards an external tool then this can be done by filtering through | |||||
feedback
|
|
Use a regular expression to find the lines, then replace them with an empty string. Here's a page that explains how to construct the regular expression: http://www.regular-expressions.info/completelines.html To do this in TextWrangler:
| ||||
|
feedback
|
|
If you search-and-replace | |||
|
feedback
|