Loading ...
Sorry, an error occurred while loading the content.

an elaborate find and replace clip

Expand Messages
  • Michael Edmonson
    hey folks! I was i need of a find and replace clip that removed content between keywords and then afterwards deleted the keywords also, after much fiddling i
    Message 1 of 1 , Apr 5, 2001
    • 0 Attachment
      hey folks!

      I was i need of a find and replace clip that removed content between keywords and then afterwards deleted the keywords also, after much fiddling i finally have a version i like, and want to share because it's NUTS! :) this is yet another example of the raw power of NoteTab. (thank you eric). I had to do this to about 12000 lines of a messed up MS word generated HTML doc, so i wrote this thing to save me time.

      Michael

      here's how it works:
      run the clip and there are three boxes
      the first is the starting keyword
      the second is the ending keyword
      the last what you want to overwrite the keywords with (leave it blank and it overwrites with nothing, basically just a simple delete)


      ^!SetHintInfo Extracting host addresses
      ^!SetScreenUpdate Off

      ^!ClearVariable %MyRowX%
      ^!ClearVariable %MyColX%

      ^!ClearVariable %MyRowY%
      ^!ClearVariable %MyColY%

      ^!Set %myBeg%=^?{text= class=| style='}; %myEnd%=^?{text2=|'}; %myEnd2%=^?{text3=|'}
      ^!SetCursor 1:1
      :Loop

      ^!Find "^%myBeg%" S
      ^!IfError Output
      ^!Jump Select_End
      ^!Set %MyRowX%=^$GetRow$; %MyColX%=^$GetCol$
      ^!Find "^%myEnd%" S
      ^!Jump Select_Start
      ^!Set %MyRowY%=^$GetRow$; %MyColY%=^$GetCol$

      ^!SetCursor ^%MyRowX%:^%MyColX%
      ^!SelectTo ^%MyRowY%:^%MyColY%

      ^!Keyboard DELETE

      ^!Goto Loop

      :Output

      ^!SetCursor 1:1

      :loop1
      ^!iferror end1
      ^!Replace "^%myBeg%^%myEnd%" >> "^%myEnd2%" TWSC
      ^!Goto loop1
      :end1




      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.