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

1

3

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

mail_address1@domain1.com; mail_address2@domain2.com; mail_address3@domain3.com; mail_address4@domain4.com; ......

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

Posted 2013-03-22T18:15:20.607

Reputation: 17 919

Answers

6

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.

Dennis

Posted 2013-03-22T18:15:20.607

Reputation: 42 934

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 – 2013-03-22T19:58:04.353

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. – Samir – 2013-03-22T20:06:51.010

I've edited my answer. – Dennis – 2013-03-22T20:10:16.547

3

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.

Kruug

Posted 2013-03-22T18:15:20.607

Reputation: 5 078

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 – 2013-03-22T19:49:30.350

His answer was not there when I started my post, but it was there before I hit the Answer button. – Kruug – 2013-03-22T20:42:26.070