Community
    • Login

    Delete two characters but not from all columns

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 1.3k 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.
    • Farnoosh AslamiF Offline
      Farnoosh Aslami
      last edited by

      Hello,
      I have large files, each includes more than one million rows, so I have to use Notepad++ instead of Excel for the first time! i intend to delete two characters (“12”) from the beginning of ONLY two columns, the first 12 started on 17th and the second 12 started on 53th position.
      I was said to use " 12(.+?(?= ))" and replace with " \1", it works well for the first seven columns, but in case of two last columns that have only two characters/values, the “12(.+?(?= ))” will delete all 12s from the 8th columns and make a mess in the last two columns. How can I fix it?
      a data row is like:

        669850.832160 12855334.50  6103459.08      912.04 12475334.50  6803459.08      812.06   12   10
      

      I would be appreciated if you could help.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @Farnoosh Aslami
        last edited by

        @Farnoosh-Aslami ,

        In the future, please do not delete the old topic and create a new one about the same question – everyone has now lost the context of what’s already gone before. Just reply to the old topic with further information.

        Farnoosh AslamiF 1 Reply Last reply Reply Quote 1
        • Terry RT Offline
          Terry R
          last edited by

          @Farnoosh-Aslami said in Delete two characters but not from all columns:

          the first 12 started on 17th and the second 12 started on 53th position.

          When I copied your example line there appeared to be a difference in the column numbers you supplied (17th and 53rd) and what the example line showed (I get 18th and 53rd for the 1 in each number, or 17th and 52nd if the position immediately before the 1). Because of that I looked at what your current regex does " 12(.+?(?= ))" to see if any adjustment (since it almost worked well enough) could help.
          I came up with
          \b12(\d+)
          and keeping the current replacement as \1

          So it will only capture if the 12 is at the start of a number and ONLY if it is followed by some more numbers. Since you only provide 1 example line there may be other issues. If so please provide more example lines, especially where it does NOT work.

          If you have issues then a regex (regular expression) could be provided that EXACTLY counts 18 (or 17) and 53 (or 52) and then provides for a replacement.

          Terry

          Farnoosh AslamiF 1 Reply Last reply Reply Quote 2
          • Farnoosh AslamiF Offline
            Farnoosh Aslami @PeterJones
            last edited by

            @PeterJones sorry for any inconvenience… it was my first time and I was unfamiliar with posting a topic… wont be repeated. thanks for your attention.

            1 Reply Last reply Reply Quote 0
            • Farnoosh AslamiF Offline
              Farnoosh Aslami @Terry R
              last edited by

              @Terry-R OMG thanks a bunch Terry… It worked perfectly. You saved me!

              1 Reply Last reply Reply Quote 1

              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