Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Trim LDAP extract

    Help wanted · · · – – – · · ·
    3
    7
    90
    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.
    • Olivier Chantraine
      Olivier Chantraine last edited by Olivier Chantraine

      Hello,
      i need to remove every first (ex:CN=toto), from my ldap export.
      its easy if there is only one.
      but my extract containt sometime more.

      ex:
      CN=toto,CN=test,DC=contoso,DC=local

      and then, the replace option remove every CN.
      If i use the mark option, its ok, but i can’t remove marqued texte (or i dont find the option)

      Could you help me with that ?
      Thanks :)

      Alan Kilborn Olivier Chantraine 3 Replies Last reply Reply Quote 0
      • Alan Kilborn
        Alan Kilborn @Olivier Chantraine last edited by Alan Kilborn

        @Olivier-Chantraine

        Your problem statement is a bit vague, but with my interpretation of it, I would try:

        Find: \A(?s)(.*?)(?-i)CN=\w+,
        Replace: ${1}
        Search mode: Regular expression

        1 Reply Last reply Reply Quote 2
        • Alan Kilborn
          Alan Kilborn @Olivier Chantraine last edited by

          @Olivier-Chantraine said in Trim LDAP extract:

          i can’t remove marqued texte (or i dont find the option)

          This option doesn’t exist because you can just use Replace instead.

          1 Reply Last reply Reply Quote 1
          • Olivier Chantraine
            Olivier Chantraine @Olivier Chantraine last edited by Olivier Chantraine

            @Olivier-Chantraine said in Trim LDAP extract:

            Hello,
            i need to remove every first (ex:CN=toto), from my ldap export.
            its easy if there is only one.
            but my extract containt sometime more.

            ex:
            CN=toto,CN=test,DC=contoso,DC=local

            and then, the replace option remove every CN.
            If i use the mark option, its ok, but i can’t remove marqued texte (or i dont find the option)

            Could you help me with that ?
            Thanks :)

            Sorry, i will try to be clear,
            i have a csv with multiple line (txt line)
            each line start with CN=
            CN=toto,CN=test,DC=contoso,DC=local
            CN=tota,OU=test,DC=contoso,DC=local
            CN=tata,OU=test2,DC=contoso,DC=local
            CN=tAto,CN=test2,DC=contoso,DC=local

            i want to remove the first “CN=text,”
            with option mark text, i use :

            ^CN.*?,
            

            and it work well (for marking only)
            but , if i replace, the regex erase all “CN=text,” in the same line

            PeterJones 1 Reply Last reply Reply Quote 0
            • PeterJones
              PeterJones @Olivier Chantraine last edited by PeterJones

              @Olivier-Chantraine said in Trim LDAP extract:

              and it work well (for marking only)
              but , if i replace, the regex erase all “CN=text,” in the same line

              That’s because after the substitution, the next CN=text, is the first CN=text, on the line, and it will match again.

              I think what you want is
              FIND = (?-s)^CN=.*?,(.*)$
              REPLACE = ${1}

              That will delete the first CN=..., on each line, leaving the rest of the line intact.

              ----

              Useful References

              • Please Read Before Posting
              • Template for Search/Replace Questions
              • Formatting Forum Posts
              • Notepad++ Online User Manual: Searching/Regex
              • FAQ: Where to find other regular expressions (regex) documentation
              Olivier Chantraine 1 Reply Last reply Reply Quote 3
              • Alan Kilborn
                Alan Kilborn last edited by Alan Kilborn

                @Olivier-Chantraine

                From the revised explanation of the problem, I can see why you liked the Mark idea (that wouldn’t work). :-)

                1 Reply Last reply Reply Quote 2
                • Olivier Chantraine
                  Olivier Chantraine @PeterJones last edited by

                  @PeterJones said in Trim LDAP extract:

                  @Olivier-Chantraine said in Trim LDAP extract:

                  and it work well (for marking only)
                  but , if i replace, the regex erase all “CN=text,” in the same line

                  That’s because after the substitution, the next CN=text, is the first CN=text, on the line, and it will match again.

                  I think what you want is
                  FIND = (?-s)^CN=.*?,(.*)$
                  REPLACE = ${1}

                  That will delete the first CN=..., on each line, leaving the rest of the line intact.

                  ----

                  Useful References

                  • Please Read Before Posting
                  • Template for Search/Replace Questions
                  • Formatting Forum Posts
                  • Notepad++ Online User Manual: Searching/Regex
                  • FAQ: Where to find other regular expressions (regex) documentation

                  Ty, its working :)

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright © 2014 NodeBB Forums | Contributors