Community
    • Login

    How do I merge data in different lines in notepad++ whatever is between two different dates?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 6.8k 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.
    • Yusuf QureshiY
      Yusuf Qureshi
      last edited by

      How do I merge data in different lines in notepad++ whatever is between two different dates?

      Example -
      "9/23/16, 09:03 - Name A: aadfajlfdjsalfj fasdfasfjalkfjalj afjaljflajf asflajfljljieoeijfhoioij jowjroiwcsojcos wjorjoijsoavaosg

      2742jsogoaj

      9/24/16, 12:05 - Name B: jgaojaegeioie ejgpoapsdfs;
      pajavpoapokads

      askjflkj gkjklgja"

      =======================================================================================

      I want to merge data after the “9/23/16, 09:03 - Name A:” ********** till the words mentioned before 9/24/16, 12:05 - Name B:

      Dates should be always in a new line only like the below matter.

      9/23/16, 09:03 - Name A: aadfajlfdjsalfj fasdfasfjalkfjalj afjaljflajf asflajfljljieoeijfhoioij jowjroiwcsojcos wjorjoijsoavaosg 2742jsogoaj
      9/24/16, 12:05 - Name B: jgaojaegeioie ejgpoapsdfs; pajavpoapokads askjflkj gkjklgja"

      Can anybody give a solution to my question as I have a huge data which is like the above example.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Yusuf Qureshi
        last edited by

        @Yusuf-Qureshi

        select the lines and then Edit->Line Operations->Join Lines

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Yusuf QureshiY
          Yusuf Qureshi
          last edited by

          Thanks a lot for replying… :) but that is what manually I can do and I am aware of that where as I have a huge data and is taking lots and lots of time doing it line by line… I was searching for a command or any sort of short cuts by which I can do it for all complete file…

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

            Hello, Yusuf Qureshi,

            As usual, a simple Search/Replacement, in Regular expression mode, is the right way to do ! So :

            • Go back to the very beginning of your file ( CTRL + Origin )

            • Open the Replace dialog ( CTRL + H )

            • In the Find what zone, insert the regex \R+(?!\d\d?/\d\d?/(\d\d)?\d\d)

            • In the Replace with zone, type any character which will replace the deleted EOL characters. It could be :

              • A space character

              • Any separator as, for instance, the | pipe character or a comma, or…

              • Nothing, if you want to join the lines, strictly

            • Select the Regular expression search mode ( IMPORTANT )

            • Click on the Replace All button

            Notes on that S/R :

            • The first part \R+ syntax matches any kind of consecutive EOL characters ( \r\n ) in Windows files, ( \n ) in Unix files or ( \r ) in Mac files

            • The third part \d\d?/\d\d?/(\d\d)?\d\d would match any date, of the form :

              • 1/12/16
              • 23/3/16
              • 10/11/16
              • 1/2/16
              • 1/12/2016
              • 23/3/2016
              • 10/11/2016
              • 1/2/2016
            • That third part is embedded in the syntax (?!.........), which is called a negative look-ahead. This means that an overall match will be true, ONLY IF, right after the EOL character(s), a date, with the above sizes, cannot be found !

            • In that case, the range of consecutive EOL character(s) will be replaced, by any string, typed in the replacement field, even nothing !

            Best Regards,

            guy038

            P.S. :

            You’ll find good documentation, about the new Boost C++ Regex library, v1.55.0 ( similar to the PERL Regular Common Expressions, v1.48.0 ), used by Notepad++, since its 6.0 version, at the TWO addresses below :

            http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html

            http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

            • The FIRST link explains the syntax, of regular expressions, in the SEARCH part

            • The SECOND link explains the syntax, of regular expressions, in the REPLACEMENT part

            We may, also, look for valuable informations, on the sites, below :

            http://www.regular-expressions.info

            http://www.rexegg.com

            http://perldoc.perl.org/perlre.html

            To end with, you may ask, the N++ Community, for infos on any tricky regex that you came across OR for building any tricky regex, for a particular purpose :-))

            Yusuf QureshiY 1 Reply Last reply Reply Quote 1
            • Yusuf QureshiY
              Yusuf Qureshi @guy038
              last edited by

              @guy038 you are the best… you just saved my lots of time. Thanks a lot you don’t know how much did you helped me here.

              Thankyou
              Thankyou
              Thankyou

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors