How can I insert a line break over 100 times for a given text string?

19,539

Solution 1

Notepad++

  1. Press Ctrl + H.

  2. Use the following settings:

    Find what:    ;        (with one trailing space)
    Replace with: \r\n
    Search Mode:  Extended
    Wrap around:  checked
    
  3. Click Replace All.

\r\n symbolizes a Windows newline, i.e., carriage return character followed by a linefeed character.

Word 2010

  1. Press Ctrl + H.

  2. Use the following settings:

    Find what:    ;        (with one trailing space)
    Replace with: ^l
    
  3. Click Replace All.

Again, ^l symbolizes a Windows newline.

Solution 2

In Notepad++:

Go to Search -> Replace (or hit Ctrl + H).

In the Find What: field, put ; (semicolon space).

In the Replace With: field, put \r\n.

Make sure Search Mode is set to Extended and that Wrap Around is enabled.

Share:
19,539
Samir
Author by

Samir

Tell me and I forget. Teach me and I remember. Engage me and I learn.

Updated on September 18, 2022

Comments

  • Samir
    Samir almost 2 years

    I got this very, very, very long text string that consists only of e-mail addresses. It's so long that it goes off my screen several pages to the right. It makes it impossible to read.

    It looks something like

    [email protected]; [email protected]; [email protected]; [email protected]; ......
    

    I essentially want to convert it into a list. Each and every e-mail address is separated by a semicolon. I imagine I should be able to take advantage of this fact, maybe create some script or something that will insert a line break at each semicolon. I would also like the semicolons to be removed.

    Can I use Notepad++ somehow?

    How about Word 2010? Or Excel 2010?

    There is a text import wizard in Excel 2010 that is able to recognize the semicolons as separators. But after clicking through the import guide the data is imported in columns rather than rows. So each e-mail address gets its' own cell in the first row.

    There is no text import wizard in Word 2010, not that I'm aware of.

  • Samir
    Samir over 11 years
    I have accepted Dennis' answer as a solution. But I have given you an up vote too, just as a way of saying thanks! Which one of you posted first anyway? It only says "answered 1 hour ago" on the page. It's interesting how you both have given me almost identical answer.
  • Samir
    Samir over 11 years
    Is there any chance I could do this in Word 2010? There is a text import guide in Excel 2010 that is able to recognize the semicolons as separators. But after clicking through the import guide the data is imported in columns rather than rows. So each e-mail address gets its' own cell in the first row.
  • Samir
    Samir over 11 years
    If no other solution is given I guess I will have to go through Notepad++ and sort out the data and then import it as plain text to whatever application I like, such as Word 2010. Notepad++ is a really handy little app, it has saved me many times before.
  • Kruug
    Kruug over 11 years
    His answer was not there when I started my post, but it was there before I hit the Answer button.