[TxMt] Re: Edit Each Line In Selection unusable for very long selections

Peter Cowan cowan.pd at gmail.com
Wed Nov 12 17:39:17 UTC 2008

2008/11/11 Dougal <dougal at gmail.com>:
> When I use Edit Each Line In Selection (alt-command-A) on very long
> selections, TextMate seems to crash.
> As a silly example:
> for i in 1 2 3 4; do for j in /usr/bin/*; do echo $j >> test; done; done
> paste -d ' ' test <(python -c "for n in range($(wc -l test | grep -oE
> '[0-9]+')): print 'is a file' ") | mate
> This file looks like:
> /usr/bin/BuildStrings is a file
> /usr/bin/CpMac is a file
> /usr/bin/DeRez is a file
> /usr/bin/GetFileInfo is a file
> /usr/bin/IPMITool is a file
> /usr/bin/ImageUnitAnalyzer is a file
> ...
> On my system, this has 3752 lines. Say now that I have it open, I want to
> change this into just the list of executable names: BuildStrings, CpMac,
> etc. The best way to do this would probably be to do a find-and-replace;
> that's really easy, in fact. But it's not the first thing that popped into
> my head. Instead, I tried to do it like this:
> - Rectangular-select the /usr/bin/ part on every line and delete it. That
> worked fine.
> - Select every line (command-A) and go into edit-each-line mode, to delete
> the "is a file" part. I can go into the edit mode okay, but as soon as I hit
> backspace, TextMate becomes unresponsive, its memory usage skyrockets, and
> basically nothing happens until I kill it.
> Is this a known problem? Why is edit-each-line mode so memory-intensive?
> It's not a major issue, since the workaround is in fact easier than this way
> of doing it, but still....
> (Why was I trying to do this in the first place? Well, my file looked like:
> error sending to joe at example.com: SMTP connection disconnected
> error sending to bobdobalina at example.com: SMTP connection disconnected
> ...
> and I wanted to get the list of emails out.)

I would try a regular expression search and replace.

1. Open the search dialog
2. Search for the following:

^error sending to (\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b).*

3. Set the replace to:


4. Make sure that "Regular Expression" is checked
5. Replace all, which should result in a file with a email address on each line.

I got that email regex from: <http://www.regular-expressions.info/>
which is also a great site to learn from.



> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate

More information about the textmate mailing list