Community
    • Login

    how to delete rows out of multiple files

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    11 Posts 4 Posters 1.1k 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.
    • Alan KilbornA
      Alan Kilborn @A Former User
      last edited by Alan Kilborn

      @holczmann-raul

      Your request is confusing.
      Follow instructions HERE.

      ? PeterJonesP 2 Replies Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by guy038

        Hello, @holczmann-raul, @alan-kilborn and All,

        Although @alan-kilborn is right about the lack of information, I think I’ve guessed what you want !

        So, could you try the following regex S/R against your file ?

        SEARCH (?xs-i) <Ticket\x20 .+? <!\x5B CDATA \x5B ( .+? ) \x5D\x5D> </Content> \R </Ticket> \R?

        REPLACE $1\r\n     or     $1\n with Unix files

        Use, either, the Replace or Replace All button

        See you later !

        Best Regards,

        guy038

        BTW, you said :

        Can anyone help me with this please

        And add :

        it really bothers me

        Well, I suppose it’s the same thing for every of us : we all want to find a way to get the job done !!

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User @Alan Kilborn
          last edited by PeterJones

          @Alan-Kilborn Thank you for investing your time in my problem.
          Unfortunately it deletes every this except the first line, like this.
          [IMAGE REDACTED]

          And i need the selected orange text to remain.
          [IMAGE REDACTED]
          From xxxxxxx to zzzzzzzz has to remain

          Thank you

          1 Reply Last reply Reply Quote 0
          • guy038G
            guy038
            last edited by guy038

            Hello, @holczmann-raul, @alan-kilborn and All,

            @holczmann-raul :

            First of all, it’s not @alan-kilborn which is trying to find out a solution to your problem but @guy038 !!


            Now, how do you expect me to modifiy the different pictures that you pasted, with some regexes ?

            So, please, when replying in this forum, paste your file contents as text, by clicking on the red icon, below :

            85813c97-5fa8-4fc7-96cc-3e782f7ff07a-Capture d’écran 2022-03-07 123711 (2).png

            Thanks for your cooperation !

            See you later !

            guy038

            Alan KilbornA ? 2 Replies Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn @guy038
              last edited by

              @guy038

              The moral of the story is, take a glance at the problem that is not presented well, and if there is any aspect that is unclear, do not try to answer, simply refer poster to the FAQ area for how to ask their question properly.

              1 Reply Last reply Reply Quote 1
              • ?
                A Former User @guy038
                last edited by PeterJones

                Hello @guy038 ,

                I replied to the wrong person, sorry. Thank you for taking your time with this problem.

                I am trying to wright my problem as clear as I can but my English is not that good.

                This is the text I have problems with.

                DATA REDACTED
                

                And I would need it to look like this:

                DATA REDACTED
                

                I need to do this with ‘Replace All in All Opened Documents’

                Thank you and once again sorry for the confusion.

                Raul

                1 Reply Last reply Reply Quote 0
                • guy038G
                  guy038
                  last edited by guy038

                  Hello, @holczmann-raul,

                  Thanks you for this version. It’s perfect !

                  I’ll be back in about 3 hours !

                  BR

                  guy038

                  1 Reply Last reply Reply Quote 0
                  • guy038G
                    guy038
                    last edited by PeterJones

                    Hi, @holczmann-raul, @alan-kilborn and All,

                    First of all, sorry for my absence, longer than expected !


                    But indeed, I do not understand why my previous regex did not work for you ?

                    Of course, in my previous regex, I kept the very first line :

                    <?xml version="1.0" encoding="utf-8"?>

                    But you should had got the correct results !


                    Thus, here is my second version which deletes the very first line, as well !

                    So, from the INPUT text :

                    DATA REDACTED
                    

                    With the following regex S/R :

                    SEARCH (?xs-i) \Q<?xml version="1.0" encoding="utf-8"?>\E \R <Ticket\x20 .+? <!\x5B CDATA \x5B ( .+? ) \x5D\x5D> </Content> \R </Ticket> \R?

                    REPLACE $1\r\n     or     $1\n for Unix files

                    You should get the expected OUTPUT :

                    DATA REDACTED
                    

                    Voila !


                    Seemingly, you have several .xml files, with the same template, all located in a specific folder. and all opened in Notepad++

                    So, the road map is :

                    • Backup this folder, preferably

                    • Start Notepad++

                    • Open all the concerned files

                    • Move to the very beginning of one of them

                    • Open the Replace dialog ( Ctrl + H )

                    • Untick all box options

                    • SEARCH (?xs-i) \Q<?xml version="1.0" encoding="utf-8"?>\E \R <Ticket\x20 .+? <!\x5B CDATA \x5B ( .+? ) \x5D\x5D> </Content> \R </Ticket> \R?

                    • REPLACE $1\r\n     or     $1\n with Unix files

                    • Select the Regular expression search mode

                    • Click on the Replace All button

                    • If the result is OK, then click on the Replace All in All Opened Documents button

                    • Click on the File > Save All option ( Ctrl + Shift + S , by default )


                    Note that I assume that the case of the very first line and the strings <Ticket, CDATA, </Content> and </Ticket> does not change !

                    If, for instance, the word CDATA may be written as Cdata, then change the modifiers, in the first part of the search regex by (?xsi)

                    Best Regards,

                    guy038

                    ? 1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User @guy038
                      last edited by

                      Hello @guy038

                      It worked like a charm! Thank you very much for your time.

                      1 Reply Last reply Reply Quote 1
                      • PeterJonesP
                        PeterJones @Alan Kilborn
                        last edited by PeterJones

                        To future readers of this topic: sorry for the missing information: the original poster deleted their posts because the data they shared had privacy violations.

                        As a moderator, I restored the posts so there’s still some context for this conversation. But I removed (“redacted”) the original data and screenshots – both from the original poster’s messages and from any replies.

                        This conversation is mostly meaningless at this point, so there’s not much to learn from. Sorry.

                        This Topic is now locked.

                        Moral

                        The data you share in this forum has to be of the same format and structure as your oringal data, otherwise we cannot help you. But you need to make sure you clean out any private or secret or sensitive information and replace it with meaningless data that has the same structure and form.

                        1 Reply Last reply Reply Quote 4
                        • PeterJonesP PeterJones locked this topic on
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors