Grep in Textwrangler for "lines starting with..."

Discussion in 'Mac Apps and Mac App Store' started by macstatic, Nov 9, 2014.

  1. macstatic, Nov 9, 2014
    Last edited: Nov 9, 2014

    macstatic macrumors 6502a

    Joined:
    Oct 21, 2005
    #1
    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).
     

Share This Page