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)? I'm trying to clean up some large files and it would be easy if I could plunk our large sections and take out the double returns.
Thanks, v
On Apr 20, 2005, at 11:30 AM, 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)? I'm trying to clean up some large files and it would be easy if I could plunk our large sections and take out the double returns.
Sure! Search for \n\n and replace with \n. You'll need to have the "regular expression" box checked in the search dialog.
If you want to replace a chunk of many returns with one (instead of just two to one), search for \n\n+ instead. --
Jonathan Chaffer Applications Developer, structure:interactive (616) 364-7423 http://www.structureinteractive.com/
This might not be the most elegant way, but I just copy a blank line and do a search & replace for that. Works great. -Ben
On Apr 20, 2005, at 8:30 AM, 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)? I'm trying to clean up some large files and it would be easy if I could plunk our large sections and take out the double returns.
Thanks, v
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
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).
Wonderful, thanks for this fast tutorial Allan & Jonathan.
On Apr 20, 2005, at 5:56 PM, Allan Odgaard wrote:
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).
On Apr 20, 2005, at 6:37 PM, Vaska.Txt wrote:
Wonderful, thanks for this fast tutorial Allan & Jonathan.
yeah, and me too ;-) that was *really* useful! -- Tom Lazar, http://tomster.org