Tapatalk

Find lines and delete every one in huge file ?

Find lines and delete every one in huge file ?

1
NewbieNewbie
1

    Mar 05, 2015#1

    I need to find all lines with a certain string and delete all the lines found.
    It should find over 10 million lines (about half of them).
    The other thing is this is a very big file, over 20 million lines.
    Can this be done with Ultraedit? So far this is the only editor I have found that can even open this file.

    6,685587
    Grand MasterGrand Master
    6,685587

      Mar 06, 2015#2

      This is of course possible. I suggest to do it without opening the file by using Search - Replace in Files.
      1. Open Search - Replace in Files.
      2. Enter as search string ^.*Your String.*(?:\r?\n|\r)
      3. Make sure the replace string edit field is empty.
      4. Make sure the option Files listed is selected.
      5. Click on button ... and select the directory containing the huge file.
      6. Enter in field above for files/type the file name without path or a wildcard string matching only the huge file in the selected directory.
      7. Enable the option Regular expressions and make sure Perl is selected.
      8. Click on button Replace All.
      It is of course also possible to open the file and use Search - Replace with the same replace options and strings. But if you have not configured UltraEdit for working with very large files, it will take longer because of recording information for various features used usually only for editing small files.

      You might test the replace on a small snippet copied into a new file using command Search - Replace before using Search - Replace in Files on the huge file.
      Best regards from an UC/UE/UES for Windows user from Austria