Community
    • Login

    How to delete lines with missing characters in certain positions

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 4 Posters 1.7k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              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 Offline
                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

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors