Removing words in a text that are specified in a blacklist

Removing words in a text that are specified in a blacklist

8

    Nov 16, 2007#1

    Any words that are in black list need to be removed from the main file.

    Suppose Blacklist contains these words:
    0x000021F0
    0x000021F4
    0x00002238
    0x00002239

    0x0000223A
    0x00022900

    Main file contains these:
    0x000021F0
    0x000021F1
    0x000021F4
    0x00002238
    0x00002239


    The final result should be, in the main file:
    0x000021F1


    Can anyone help me?
    And also if possible, please post the fastest versions incase it's a macro.

    6,602547
    Grand MasterGrand Master
    6,602547

      Nov 16, 2007#2

      The macro below will do it. Make sure you have only the 2 files open and the blacklist file as the focus when executing the macro.

      It is important that the blacklist file does not contain blank lines!

      The macro property Continue if a Find with Replace not found or Continue if search string not found must be checked for this macro.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Clipboard 9
      SelectAll
      Copy
      EndSelect
      Top
      NextWindow
      Bottom
      IfColNumGt 1
      InsertLine
      EndIf
      Top
      Paste
      ClearClipboard
      Clipboard 0
      IfColNum 1
      "#
      "
      Else
      "
      #
      "
      EndIf
      Top
      Loop
      IfCharIs "#"
      DeleteLine
      ExitLoop
      EndIf
      SelectLine
      Find MatchCase "^s"
      Replace All ""
      EndLoop

      The macro above works only if there is no line containing a word which exists also as substring at end of another line. For example if there is in the blacklist:

      ship
      bicycle

      and the other list contains

      ship
      car
      star
      ship
      truck
      bicycle

      the result of the macro above would be

      car
      startruck

      The reason is that the macro above does not make sure that entire lines are searched and replaced which is no problem on the data of UltraEditLover. A more general version of the macro above is following macro with 2 small modifications which takes lists like above into account because it replaces always only entire lines.

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Clipboard 9
      SelectAll
      Copy
      EndSelect
      Top
      NextWindow
      Bottom
      IfColNumGt 1
      InsertLine
      EndIf
      Top
      Paste
      ClearClipboard
      Clipboard 0
      IfColNum 1
      "#
      "
      Else
      "
      #
      "
      EndIf
      Top
      Find RegExp "%^([~#^p]^)"
      Replace All "!StArT^1"

      Loop
      IfCharIs "#"
      DeleteLine
      ExitLoop
      EndIf
      SelectLine
      Find MatchCase "^s"
      Replace All ""
      EndLoop
      Find MatchCase "!StArT"
      Replace All ""

      8

        Nov 17, 2007#3

        THANK you!

        UltraEdit THEEE best. :D

        I was going through horrible yet slow and unoptimized Vb6 2 elimination list process :lol: .