• Login
Community
  • Login

How to insert blank line in between every line

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
16 Posts 7 Posters 11.9k 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.
  • S
    Sean Shaffer
    last edited by Jul 17, 2019, 4:43 AM

    Is there a way to easily “double-space” my document by inserting a blank line in between every line I have selected or all lines in the document? I don’t see a one-click solution for this under Edit->Line Operations

    A 1 Reply Last reply Jul 17, 2019, 4:50 AM Reply Quote 0
    • A
      andrecool-68 @Sean Shaffer
      last edited by andrecool-68 Jul 17, 2019, 4:52 AM Jul 17, 2019, 4:50 AM

      @Sean-Shaffer
      Option Find and Replace
      Find: $
      Replace: \n
      This will add an empty line to each line.

      A 1 Reply Last reply Jul 17, 2019, 12:08 PM Reply Quote 0
      • A
        Alan Kilborn @andrecool-68
        last edited by Jul 17, 2019, 12:08 PM

        @andrecool-68

        Hmmmmmm. Well, that might be bad if the OP is using anything other than Unix/Linux line endings. Plus, I wouldn’t think that the user would want to turn blank lines into a bigger section of blank lines.

        I’d try:

        Find: ^.+(\R)
        Replace: $0\1
        Search mode: Regular expression

        A A 2 Replies Last reply Jul 17, 2019, 2:43 PM Reply Quote 4
        • A
          Alan Kilborn @Alan Kilborn
          last edited by Jul 17, 2019, 2:43 PM

          To be better, go with:

          Find: (?-s)^.+(\R)

          (…since we don’t know the user’s setting of the . matches newline checkbox. The above change makes that checkbox’s setting irrelevant.)

          A 1 Reply Last reply Aug 9, 2022, 12:52 AM Reply Quote 2
          • A
            Alan Kilborn
            last edited by Jul 17, 2019, 2:54 PM

            Alternatively, a well-placed ? in the original would have made it okay, even without the (?-s) and without caring about the checkbox setting:

            Find: ^.+?(\R)

            And no, Peter, repeated postings by me here is not a veiled attempt for more upvotes. :)

            E 1 Reply Last reply Jul 17, 2019, 3:01 PM Reply Quote 2
            • E
              Ekopalypse @Alan Kilborn
              last edited by Jul 17, 2019, 3:01 PM

              @Alan-Kilborn

              hmm - what about
              find: \R
              replace: $0$0
              ?
              ;-)

              A 1 Reply Last reply Jul 17, 2019, 3:39 PM Reply Quote 2
              • A
                Alan Kilborn @Ekopalypse
                last edited by Alan Kilborn Jul 17, 2019, 3:40 PM Jul 17, 2019, 3:39 PM

                @Ekopalypse

                For me, that puts too much “blankness” in certain spots (say, between “paragraphs”). But since we have no idea really what the OP wants for this circumstance…

                1 Reply Last reply Reply Quote 3
                • S
                  Sean Shaffer
                  last edited by PeterJones Jan 29, 2025, 8:04 PM Jul 17, 2019, 9:58 PM

                  I’m editing a list of trackers for torrenting. For better readability, I want each line to be spaced apart. For example,

                  http://redacted1/announce
                  http://redacted2/announce
                  http://redacted3/announce
                  

                  would become:

                  http://redacted1/announce
                  
                  http://redacted2/announce
                  
                  http://redacted3/announce
                  

                  moderator redacted urls and added code block; we don’t want this topic to become a honeypot for torrent-advertising spam

                  A 1 Reply Last reply Aug 9, 2022, 12:41 AM Reply Quote 1
                  • S
                    Sean Shaffer
                    last edited by Jul 17, 2019, 11:09 PM

                    Alan Kilborn provided the correct Find/Replace solution. Thank you!

                    1 Reply Last reply Reply Quote 3
                    • A
                      A3 W2 @Alan Kilborn
                      last edited by Aug 9, 2022, 12:36 AM

                      @Alan-Kilborn That worked for me, Thanks.
                      Had same problem with separating a list of trackers as OP.

                      1 Reply Last reply Reply Quote 0
                      • A
                        A3 W2 @Sean Shaffer
                        last edited by Aug 9, 2022, 12:41 AM

                        @Sean-Shaffer It’s not just for readability. It simply doesn’t work other way. I mean when you copy-paste a list of trackers - it has to be line separated like that, otherwise it just doesn’t work (talking uTorrent here).
                        So when i update the list in Notepad++ i hit “remove duplicates” and that also removes empty lines between addresses. So then i need to put them back, which this post helped me do. Nice, thanks everybody.

                        1 Reply Last reply Reply Quote 0
                        • A
                          A3 W2 @Alan Kilborn
                          last edited by Aug 9, 2022, 12:52 AM

                          @Alan-Kilborn said in How to insert blank line in between every line:

                          Find: (?-s)^.+(\R)

                          typing this in Find does nothing and some small windows opens :) trying to use Replace messes up whole document, leaving only 2 lines there.
                          1st suggestion work fine, but that second idk, i wasn’t able to make it work.

                          1 Reply Last reply Reply Quote 0
                          • S
                            Slobodan Krstić
                            last edited by Mar 27, 2024, 12:10 PM

                            Re: How to insert blank line in between every line
                            Using column selection (alt - left mouse btn)
                            A.png
                            press enter
                            B.png
                            Maybe the fastest way :))

                            1 Reply Last reply Reply Quote 1
                            • C
                              Chris Stott
                              last edited by Jan 29, 2025, 7:46 PM

                              This worked for me on tracker list

                              Find: \n
                              replace: \n\n
                              search mode: extended

                              if you replace with \n\n\n it adds 2 lines inbetween

                              before:

                              after:

                              hope this helps


                              moderator deleted before/after data; don’t want this to become a honeypot for tracker url spamming

                              A 1 Reply Last reply Jan 29, 2025, 8:02 PM Reply Quote 0
                              • A
                                Alan Kilborn @Chris Stott
                                last edited by Alan Kilborn Jan 29, 2025, 9:53 PM Jan 29, 2025, 8:02 PM

                                @Chris-Stott said in How to insert blank line in between every line:

                                Find: \n
                                replace: \n\n
                                search mode: extended

                                This is rather dangerous.
                                Nice way to corrupt your files, possibly unknowingly, if your files are Windows and not Linux.

                                A better way might be:
                                Find: (\R)
                                Replace: $1$1
                                Search mode: Regular expression
                                I suppose this is about the same as @Ekopalypse 's post earlier, Jul 17, 2019, 11:01 AM.

                                E 1 Reply Last reply Jan 30, 2025, 10:34 AM Reply Quote 3
                                • E
                                  Ekopalypse @Alan Kilborn
                                  last edited by Jan 30, 2025, 10:34 AM

                                  @Alan-Kilborn said in How to insert blank line in between every line:

                                  I suppose this is about the same as @Ekopalypse 's post earlie

                                  No … I have zero dollars, you have two? No cookies for me :(

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