Replace Comma with Line Break



I use The SEO System everyday to get my pages to the top! --Richard

Early this week, I had a simple technical problem that required me to replace all commas in a list with line breaks.  This should be a simple one that will take no more than 5 minutes.   I typed into Google “replace comma with line break” intent on a quick solution but no instant fix awaited.

Thus, I am writing about it in the hopes that whoever has to replace a comma with a line break will not have to scurry around looking for a solution.

If you want to know how to replace a comma with a line break, you clearly have a rather large comma delimited list with which you are dealing.  (If you just have a few words, you would do it manually, right?).  I had a list of keywords numbering more than 10,000 and so I could not do it manually.

But, for the sake of this article, let’s assume I simply had the following list of 10 golfers:   (This is the list of best finishers at this year’s British Open which,  if you did not see, you missed something special!)

Stewart Cink,Tom Watson,Chris Wood,Lee Westwood,Luke Donald,Retief Goosen,Mathew Goggin,Soren Hansen,Ernie Els,Justin Leonard

Ok, our goal is to turn this list of comma separated items into line separated items.

To manipulate text in many ways, I always use UltraEdit.  This is the best text editor and a requirement for anyone involved in SEO or text manipulation.  With UltraEdit, the solution is very simple.

With your document open, choose Search | Replace.  In the “Replace” Dialog Box, enter a comma in the “Find What” field.  In the “Replace With” field, put “^p ” without the quotes.  ^p will add a line break.

And…that’s it.  You are done.  Your list should now look like this:

Stewart Cink
Tom Watson
Chris Wood
Lee Westwood
Luke Donald
Retief Goosen
Mathew Goggin
Soren Hansen
Ernie Els
Justin Leonard

When you have thousands of entries to modify, I hope this little tip on how to replace a comma with a line break helps you.

Good luck!

Note to Readers: I have just released The SEO System, a system that I have personally developed and used for years to get web pages to the top of the search engines. It is available to my visitors now. The SEO System will save you a lot of time and dramatically improve your search engine results. Read more...

Want a fresh, unique SEO perspective once a week? Subscribe to Richard Cummings now.

Other SEO, Blogging, and Technical Artilces You May Enjoy

, , , ,

3 Responses to “Replace Comma with Line Break”

  1. Nima Says:

    Hi Richard, Thanks for this article, I’m trying to do the vice versa.. Any ideas how to do that? (Break line -> Comma).

    Thanks

  2. Michelle Says:

    @Nma, you can use a tool like List Magician. It converts lists to comma separated and to line breaks.


Trackbacks/Pingbacks

  1. [...] example, in the article I just wrote called Replace Comma with Line Break (this is a WYSIWIG link), I may need to refer to the HTML source code for that link if I wanted to [...]

Leave a Reply