-1

I would like to delete all lines from my large text file which have more than one colon.

An explanation of how the code works would also be much appreciated.

Example:

yes:no:no
yes:no
yes:no
no:yes
yes:yes:no

What I want:

yes:no
yes:no
no:yes

So it deletes the first and last lines because they had more than 1 colon.

Stevoisiak
  • 23,794
  • 27
  • 122
  • 225

1 Answers1

2

Use this:

CTRL+H

Find:

.*:.*:.*\r\n

Replace: (enter nothing)

Note that I am assuming Windows line endings here (\r\n). If you are running on Unix then you would just use \n as the line ending, so the regex would be:

.*:.*:.*\n

Here is a screen capture for reference:

enter image description here

Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360