Remove contents of one file from another

Remove contents of one file from another

1
NewbieNewbie
1

    May 08, 2008#1

    Say I have 2 text files where each line is simply a domain name. I need to remove from file1 the contents of file2. Note that file1 is 80000 or so lines long. Is that something that UltraEdit can do or would UltraCompare be needed? In either case is this something that can be accomplished with built in commands or would some scripting be required?

    6,681583
    Grand MasterGrand Master
    6,681583

      May 09, 2008#2

      That can be done with a simple macro. Make sure you have only the 2 files open and file 2 with the lines which should be deleted in file 1 has the focus when you run the macro. The macro is written for DOS files. If you run it on UNIX files without automatical convert of the UNIX line endings to DOS line endings replace all 3 ^p by ^n in the macro.

      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
      Bottom
      IfColNum 1
      Else
      "
      "
      EndIf
      Top
      TrimTrailingSpaces
      Loop
      Find "^p^p"
      Replace All "^p"
      IfNotFound
      ExitLoop
      EndIf
      EndLoop
      SelectAll
      Clipboard 9
      Copy
      CloseFile NoSave
      Top
      Paste
      ClearClipboard
      Clipboard 0
      "#
      "
      Bottom
      IfColNum 1
      Else
      "
      "
      EndIf
      Top
      Loop
      IfCharIs "#"
      DeleteLine
      ExitLoop
      EndIf
      SelectLine
      Find "^s"
      Replace All ""
      EndLoop

      Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.
      Best regards from an UC/UE/UES for Windows user from Austria