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

macstatic

macrumors 68020
Original poster
Oct 21, 2005
2,059
176
Norway
I would like to remove all lines in a text file starting with ">From " using TextWrangler. It seems the grep function is the way to go.

The following I found the following to work: ^(>From ).*
and in the replace text-box just entering nothing. This works except it replaces those lines with an empty line. I want it removed.

Once I have this working I'd like to fix a bunch of separate text files the same way.
Is this just a matter of using Search - Multi-File Search... and selecting the grep term which I've previously saved as a preset?
Ideally I'd like TextWrangler to:

1) open the first file in a specific folder
2) remove the offending lines as above
3) save the file with the same name, but appending "_edit" at the end
4) repeat by opening the next file in the same folder

Can this be done or do I have to work on file copies, then batch rename them afterwords (A Better Finder Rename is great for this sort of thing).
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.