Tapatalk

Selective Replace In Files

Selective Replace In Files

3
NewbieNewbie
3

    Feb 22, 2005#1

    Hi,


    I wonder if there's any way to selectively replace in files. A product called SNiFF had this feature, where you would get a list of matches (with the match marked up in color as far as I remember) and then you could right click on the matched line or something similar to either replace or not.

    I always have a weird feeling in my stomach when I let it globally replace without being able to control what it really does - and sometimes, regex pattern matching isn't sufficient to differenatiate between what needs to be replaced and what doesn't ...

    Macros ? Feature suggestion ?


    Thanks

    119
    Power UserPower User
    119

      Feb 23, 2005#2

      If you want to individually approve each change, don't hit the "Replace All" button. Press "Start" instead.

      3
      NewbieNewbie
      3

        Feb 23, 2005#3

        There is no Start button in the Replace In Files dialog ...

        1
        NewbieNewbie
        1

          Jan 31, 2006#4

          :?: Did anyone ever answer this question? This is one of my most missed features since I moved over to Ultraedit from CodeWright.

          6,685587
          Grand MasterGrand Master
          6,685587

            Feb 01, 2006#5

            A possible workaround:

            Close all open files. Then use Find In Files instead of Replace In Files and and let the search result be captured to the output window. Now you can evaluate the lines with your search string. If a line should be changed, double click on the line with the file name and the file will be opened. After opening all files where the replace should be done run a simple normal Replace with Replace All on all open files.

            This workaround will not work if you have more than 1 search hit in a file and not all strings should be replaced by the new string in this file. Maybe you will find a better regular expression search string which only finds the strings which should be replaced.

            An other workaround which does not have the limitation described above would be to use a macro. First run the Find In Files and capture the search results to an edit window. Look at the lines and delete those lines, where the replace should not be done. The macro now could open the remaining files, searches for each line and replace the string in this line. Maybe also GotoLine with the number in the clipboard (taken from the search result edit window) works, but I have never tested it.
            Best regards from an UC/UE/UES for Windows user from Austria