Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace line-breaks with commas using grep in TextWrangler?

I have a text-file container a number of lines, which I need to turn into a csv. What is the easiest way to replace all the line-breaks with ", ". I have TextWrangler and read that it would do so by using grep and regular expressions, but have very little experience using regular expressions and don't know how grep works. Anyone who can help me get started?

like image 886
zkwsk Avatar asked Jul 26 '11 18:07

zkwsk


1 Answers

  1. Choose Find from the Search menu. TextWrangler opens the Find window.
  2. Select the "Grep" checkbox
  3. Type the string you are looking for ("\n" or "\r\n" or "\r") in the Find textfield.
  4. Type the replace string (", ") in the Replace text field.
  5. Click "Replace All"

See chapters 7 and 8 of the TextWrangler User Manual if you have problems.

like image 120
Andrew Clark Avatar answered Nov 03 '22 04:11

Andrew Clark