Apr 2, 2014

How to replace line break with comma in text pad

A friend of mine asked me how to search and replace new line characters on TextPad editor. Sometimes we want to form a comma seperated values of all data in a column. It takes time to edit this manually and form the list.

Fortunately, TextPad supports "regular expressions" using which may come handy on several occasions. It is fairly simple as long as you know that "\n" means a new line in the world of computers, and the awareness that TextPad supports Regular Expressions syntax.

Here is an example document with random words:
document with words in multiple lines
And you fire the replace operation by hitting F8.
Find What: type \n
Replace with: type , (or whatever character you need)
Check "Regular Expression" box before you search / replace
And it will be all merged on to the same line. This looks simple while for an user trying to do this on a several hundred line file, would give big sigh of relief after learning this.
Final result after the replace operation

You may also like these writeups

Related Posts with Thumbnails