Community
    • Login

    Delete two characters but not from all columns

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 851 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.
    • Farnoosh AslamiF
      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
        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
          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
            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
              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
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors