Tapatalk

Delete all lines found by a search not working (solved)

Delete all lines found by a search not working (solved)

4
NewbieNewbie
4

    Apr 03, 2019#1

    The "delete all line" type commands do not seem to work for me. They run and initially appears that worked but the lines are actually not deleted from the file. The file I am working with has approximately 60000 lines (10 MB) and I am either hiding or bookmarking approximately 126 lines in the file (throughout the file and not sequential lines). I have tried two different methods to delete all 126 lines:
     
    1. Run search to find lines, right click in find string window and select bookmark all lines (bookmarks show up), Select the "Delete all bookmarked lines" from the home menu -> bookmarks dropdown. Command runs and BOOKMARKS disappear, but the lines are still in the file.
    2. Run search to find lines with filter on and hide radio selected. Select the "Delete all hidden lines" from the edit menu -> delete dropdown. Command runs but the lines appear in the file (no longer hidden) but still exist in the file.
     
    What can be stopping the lines from actually deleting? I can delete the lines manually by selecting a line and selecting delete line.

    Licensed UltraEdit version:
    UltraEdit Text/Hex Editor (x64) 
    Version 26.00.0.48

    Has anyone else seen this issue? Is the size of file the issue possibly?

    Thanks.

    19176
    MasterMaster
    19176

      Apr 03, 2019#2

      Hi,

      my first test:
      • size: 47 MB
      • lines: 856 800
      • encoding: UTF-16
      • matches: 28560
      • method: delete all hidden lines (bookmarks are too limited)
      • result: 28560 deleted lines, pattern not found anymore
      my second test:
      • size: 24 MB
      • lines: 856 800
      • encoding: UTF-8
      • matches: 28560
      • method: delete all hidden lines
      • result: 28560 deleted lines, pattern not found anymore
      my third test:
      • size: 24 MB
      • lines: 856 800
      • encoding: ANSI
      • matches: 28560
      • method: delete all hidden lines
      • result: 28560 deleted lines, pattern not found anymore

      BR, Fleggy

      UE 26.00.0.62 x64
      W10Pro 1809

      4
      NewbieNewbie
      4

        Apr 03, 2019#3

        Thank you for testing.

        Based on additional test run it appears this occurs if lines in the file are too long.  The log files where lines were being selected had lines as long as 1200 characters (Large JSON strings within logs).  When the delete all lines command is run it actually does delete the correct number of lines (saved off post changed file and compared to original file) but they are not the bookmarked nor hidden lines that the delete hidden or delete bookmark lines should have deleted.

        Thanks.

        19176
        MasterMaster
        19176

          Apr 04, 2019#4

          Well, I prepared a test file:
          - 524800 lines, size 1 GB
          - length of "normal" lines: 2100
          - length of lines to delete: 2103
          - count of lines to delete: 256
          - result: 256 lines deleted, pattern not found anymore

          Could you create a mangled copy of your JSON with same file structure (preserve lines' length and the text to delete), test this file and put this file on some public web storage if the problem persists?

          6,685587
          Grand MasterGrand Master
          6,685587

            Apr 04, 2019#5

            Yes, please create a large example file containing only two types of long lines. One long line occurs thousands of times and another long line just 200 times somewhere between the other long lines. Next test if deletion of the long line occurring only 200 times fails by the procedures used by you. Compress the large file into a 7-Zip, RAR or ZIP archive if this is indeed the case and upload the very small archive file as attachment to your next post describing additionally step by step how you tried to delete the 200 lines.

            And open Advanced - Settings or Configuration - Editor display - Miscellaneous and make sure the configuration setting Disable line numbers is not checked as counting lines in file is necessary for bookmarking lines and hiding lines and of course finally also for deleting the bookmarked and hidden lines.

            By the way a Unix/Perl regular expression replace with search string ^.*word.*\r\n and an empty replace string deletes all lines containing word and having a carriage return + line-feed line ending (DOS terminated lines). The same can be achieved with running an UltraEdit regular expression replace with search string %*word*^p and an empty replace string. Last line of file is not deleted even on containing word if last line of file has no line termination. For a UNIX file with just line-feed as line termination use just n instead of \r\n (Unix/Perl) or ^n instead of ^p (UltraEdit).
            Best regards from an UC/UE/UES for Windows user from Austria

            4
            NewbieNewbie
            4

              Apr 04, 2019#6

              Update: Based on input from support it looks like this is being caused by file having mixed line terminators. I verified this by converting line terminators to DOS, saved file, and then found string, bookmarked, and deleted lines successfully. I was able to repeat this with a couple files that was seeing this so looks like the culprit is the mixed line terminators.

              Thanks.