[TxMt] line breaks

Allan Odgaard allan at macromates.com
Wed Apr 20 15:56:50 UTC 2005


On Apr 20, 2005, at 17:30, Vaska.Txt wrote:

> Certainly, this might an odd request, but is there some way to delete 
> line breaks (\n) in a text document?  Or, only when there are two in a 
> row (double spacing)?

As was already mentioned, you can do find'n'replace. Adding to this: 
you can press option-return in the Find dialog to insert a return. You 
can also select two empty lines and press cmd-E to place these in the 
Find dialog.

Additionally you can use option-shift-R (Filter through command), 
select document/replace document as input/output and let the command 
be: “tr -s '\n'”. The -s means “squeeze” the characters together so 
there is only one. This is a very useful command to clean up documents 
since it can take a group of characters, e.g.: “tr -s '[ \t\n]'”, and 
it can also do replacements in the same go, so e.g. this command: “tr 
-s '[ \t\n]' ' '” transforms the document into only having one space 
for every sequence of tabs, newlines, or spaces (i.e. format the entire 
document into one big paragraph).




More information about the textmate mailing list