Community
    • Login

    How to delete lines with missing characters in certain positions

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 4 Posters 595 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Bpy72876175B
      Bpy72876175
      last edited by

      I’m trying to delete lines that have missing characters in certain positions of a line. So if line position 18 is blank, I’d like to delete the entire line.

      Bart TerrynB 1 Reply Last reply Reply Quote 1
      • Bart TerrynB
        Bart Terryn @Bpy72876175
        last edited by

        @Bpy72876175 What about the following?
        (warning - completely untested)
        f0d03655-7a93-499b-8906-27cda03abc49-image.png

        Bart TerrynB 1 Reply Last reply Reply Quote 0
        • Bart TerrynB
          Bart Terryn @Bart Terryn
          last edited by Bart Terryn

          @Bart-Terryn regex is:

          ^.{17}\s.*$
          

          (in case you want to cut and paste)

          1 Reply Last reply Reply Quote 2
          • Bpy72876175B
            Bpy72876175
            last edited by

            It worked!!! Thank you so much. More of a business guy here not a coder, but I used that and just changed the character position as needed to Bookmark those lines…and then delete. Thank you again

            PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 2
            • PeterJonesP
              PeterJones @Bpy72876175
              last edited by

              @Bpy72876175 said in How to delete lines with missing characters in certain positions:

              I used that and just changed the character position as needed to Bookmark those lines…and then delete.

              Good job generalizing and figuring out how to adapt someone’s solution to your needs.

              If you want to get rid of the blank lines as well, just change @Bart-Terryn’s regex to ^.{17}\s.*\R?, so it will include the newline sequence when it deletes the data on that line.

              1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @Bpy72876175
                last edited by

                @Bpy72876175 said in How to delete lines with missing characters in certain positions:

                More of a business guy here not a coder, but I used that and just changed the character position as needed to Bookmark those lines

                But you seem to already know your way around Notepad++ pretty well, if you were able to “bookmark” matching lines and delete them.

                For others that might not be so savvy, here’s how it could have been done:

                Use the Mark All command on the Mark tab of the Find window to get lines with a “blank” in the appropriate column to appear in red and have a “blue ball” symbol to their left – the blue ball is the bookmarking symbol:

                Imgur

                Right click on a bookmarking symbol (actually anywhere in the column of the blue balls is fine) and a menu will appear, from which you may then choose Remove Bookmarked Lines:

                Imgur

                After executing that the bookmarked lines (and the blue balls) are gone.

                1 Reply Last reply Reply Quote 2
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors