Join lines

Join lines

11
Basic UserBasic User
11

    Nov 29, 2006#1

    I can't find out how to join lines. :)

    There's no such option in UE?

    344
    MasterMaster
    344

      Nov 29, 2006#2

      What do you want to do ? Just for 2 lines?
      Go to the end of line 1 and press the "del" key.
      Line 2 jumps up then.

      Otherwise, explain more ....
      Normally using all newest english version incl. each hotfix. Win 10 64 bit

      11
      Basic UserBasic User
      11

        Nov 29, 2006#3

        I want to join more lines to one line, many times in my text.

        I cannot find any JOIN LINES option in UE.

        BTW, i know the del key :)

        344
        MasterMaster
        344

          Nov 29, 2006#4

          Ah yes, ok. Mark the lines you want to join and let run this macro:
          (I call this joinLines):

          Code: Select all

          InsertMode
          ColumnModeOff
          HexOff
          PerlReOn
          Find RegExp "\r\n"
          Replace All SelectText ""
          It runs for DOS files. For Unix files \n alone should do the job.

          rds Bego
          Normally using all newest english version incl. each hotfix. Win 10 64 bit

          11
          Basic UserBasic User
          11

            Nov 29, 2006#5

            Thank you.

            It does not work.
            It joins all lines and not the selected lines :-)

            344
            MasterMaster
            344

              Nov 30, 2006#6

              Well, it WORKED this morning in my 11.whatever version in business. I tested it there.
              At home now (12.20a+4) it does not work. (I mean I read sth. similar that regexp stuff and selectedtext did not work ...)
              However, if you select your lines, open your replace dialog:
              find: \r\n
              replace : <nothing>
              range: "selected text"
              and you have regexp "set on" and use the perl regexp as default (see your UE-options) it does work fine.

              rds Bego
              Normally using all newest english version incl. each hotfix. Win 10 64 bit

              5
              NewbieNewbie
              5

                Nov 30, 2006#7

                Try this: highlight the lines you want to be joined and select the '-> Format -> Convert CR/LFs to Wrap' from the menu.

                11
                Basic UserBasic User
                11

                  Nov 30, 2006#8

                  Yes that's it!!!!
                  Thank you YanHan and Bego.

                  I've just seen that there are too much spaces in the text.

                  p.e.

                  this is the
                  text to
                  join

                  --->

                  this is the (2 spaces) text to (2 spaces) join

                  (?)

                  6,675585
                  Grand MasterGrand Master
                  6,675585

                    Nov 30, 2006#9

                    Hi to all here!

                    Why are you all making things more complicated as needed?

                    Removing the line terminations from all lines of a selection can be done with an extremly simple non regular expression replace in selected area.
                    1. Select the area.
                    2. Press Ctrl+R to open the replace dialog
                    3. Enter ^p in the Find What field and make sure nothing is in the Replace With field.
                    4. Uncheck any additional option.
                    5. Select Selected Text in the Replace Where group.
                    6. Press button Replace All.
                    That's it for files with DOS line terminations or UNIX/MAC files open with temporary conversion to DOS format as I always suggest.

                    For UNIX files opened really in UNIX mode use ^n instead of ^p.

                    The procedure above as macro if you often need it:

                    IfSel
                    Find "^p"
                    Replace All SelectText ""
                    EndIf

                    Well, this macro will not work with UltraEdit v12.10b or UEStudio v6.00a if the Perl compatible regular expression engine is active although the replace is not a regular expression. Upgrade or downgrade to any other version of UE/UES which don't have this strange bug or don't use the Perl engine.
                    Best regards from an UC/UE/UES for Windows user from Austria

                    11
                    Basic UserBasic User
                    11

                      Nov 30, 2006#10

                      Thank you Mofi.
                      That is the solution!

                      If I select all text the whole text will be joined to 1 line.

                      Would it be possible if double LF/CR not to replace the second LF/CR?

                      6,675585
                      Grand MasterGrand Master
                      6,675585

                        Nov 30, 2006#11

                        ganda wrote:Would it be possible if double LF/CR not to replace the second LF/CR?
                        No and yes!

                        No because DOS files have CR/LF and not LF/CR.

                        Yes, but now you need a regular expression search and replace.

                        IfSel
                        UnixReOff
                        Find RegExp "^p^([~^p]^)"
                        Replace All SelectText "^1"
                        EndIf

                        Add UnixReOn or PerlReOn (v12+ of UE) before command EndIf if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.

                        The regular expression now removes the CRLF only if a following character exists which is not a CRLF line termination.
                        Best regards from an UC/UE/UES for Windows user from Austria

                        344
                        MasterMaster
                        344

                          Nov 30, 2006#12

                          Mofi war mal wieder schneller :-)

                          I did the perl regexp approach, but it does it similar.
                          I just say a "word character" instead of a "non paragraph"
                          A ^p seems not to work in this case:

                          Find: (\w)\r\n
                          rep: <nothing>

                          Code: Select all

                          111
                          222
                          
                          empty line before
                          444
                          555

                          Code: Select all

                          111222
                          empty line before444555
                          Normally using all newest english version incl. each hotfix. Win 10 64 bit

                          11
                          Basic UserBasic User
                          11

                            Nov 30, 2006#13

                            Mofi wrote:IfSel
                            UnixReOff
                            Find RegExp "^p^([~^p]^)"
                            Replace All SelectText "^1"
                            EndIf
                            Thank you Mofi.
                            It still creates one line of text. :(

                            6,675585
                            Grand MasterGrand Master
                            6,675585

                              Nov 30, 2006#14

                              Then in your file there is no CRLF CRLF, there are CRLF 1 or more spaces or tabs CRLF. So please tell us at last what your file really contains exactly and how it should look like after the replace/macro.
                              Best regards from an UC/UE/UES for Windows user from Austria