Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete \n in Textmate

Tags:

textmate

Given a file which contains new lines, using Textmate, how can i remove them from the document

Given a text file

a


b

c

I'd like to end up with

a
b
c
like image 810
James Raitsev Avatar asked Jan 08 '13 15:01

James Raitsev


2 Answers

I would use the regular expression ^\s*$\n which will match any line that is empty or contains only whitespace characters.

Just run Replace All with that in the Find box, and with the replace box empty.

like image 120
Joel Westberg Avatar answered Nov 15 '22 06:11

Joel Westberg


Replace "\n+" with "\n" (be sure that "regular expression" checkbox is on). This replaces several consecutive linebreaks with only one.

like image 20
Sergio Tulentsev Avatar answered Nov 15 '22 07:11

Sergio Tulentsev