Select every other line of a text file on Textmate

❦ First Published on

Lets say you have a YouTube transcript text file structured like this:

0:00
so I think the difference in in a poem
0:05
or a work of literary artists that we
0:07
say story know is that it isn’t for the

You want to select the lines with numbers and delete them.

In my case I’m using the Textmate text editor, but the following technique using regular expressions, sequences of characters that specify a pattern to match on a text, should work with other editors, like Notepad++, too:

  1. Press Cmd-F to open the search dialog box. Make sure the Regular Expression checkbox is ticked.
  2. Put the following in Find:
    ([^\n]\n)[^\n]\n?
  3. And this in Replace (notice the space before $):
     $1
  4. Click Replace All.


· ˖ ✦ . ˳

Possibly Related:

˳ · ˖

Prior entry:
Next entry: