I'm trying to get rid of everything after a column in Notepad++. Column mode is not an option. Is it possible?

What I have:    159 ms          [n/a]                   21        134 ms          [n/a]                   21         75 ms           [n/a]                   21        87 ms           www.portless.net        21        89 ms           www.popovetsky.org      21        95 ms           www.psmythe.net         21        98 ms           wasabi.prostructure.com 21        89 ms           crm.prostructure.com    21        87 ms           internal.prostructure.com21 

What I want:
  • 2
    Are the columns tab-separated?
    – Excellll
    Aug 19, 2014 at 18:15
  • 3
    One more question: does the data you want to keep ever include a space?
    – Excellll
    Aug 19, 2014 at 18:26
  • 1
    nope i only need the ips
    – Bob J
    Aug 19, 2014 at 18:31
  • 20
    Why you want to do that in notepad++? Why column mode is not an option?
    – Kamil
    Aug 19, 2014 at 18:36
  • 1
    You could use column mode to delete the second column to the EOL, and then use the Trim Trailing and save to get rid of the whitespace. Aug 20, 2014 at 21:58

11 Answers 11


If the data in the first column never contains a space, you can use a regular expression find and replace to get what you want.

In regular expression mode, search for:

^([^ ]*).*

And replace with


What this does:

^ indicates that any match should start at the beginning of a line.
([^ ]*) is any expression that does not contain a space. The match is greedy, so this will match everything up to the first space (or the end of the line, whichever comes first).
.* is everything else on the line.

\1 refers to the part of the match inside the parentheses. That is, the entire line is replaced by just the bit from the first column.

  • 5
    Nice to know that notepad++ supports regular expressions in search-replace!
    – Kamil
    Aug 19, 2014 at 18:37
  • 1
    Regex will do the job for you so long as the data never contains a space. Simpler would be the UNIX 'cut' command but doing UNIX commands under windows is whole 'nother problem. cut is made for this and processes large files quickly, with defined column delimiters or by character-counts.
    – Karl
    Aug 19, 2014 at 18:39
  • 31
    This can be done far more simply: replace " .*" (note the leading space) with "" (i.e. nothing) to delete everything after and including the first space.
    – ashastral
    Aug 19, 2014 at 20:52
  • 2
    @Fraxtil Thanks. You should post that as an answer. You'll get an upvote from me.
    – Excellll
    Aug 19, 2014 at 21:11
  • @Excellll alright, done.
    – ashastral
    Aug 19, 2014 at 21:19

Here's a simpler regular expression you can use to achieve the same effect. Replace


(note the leading space)

with nothing. This will delete everything after and including the first space. This will work as long as your IP addresses are never prefixed with any whitespace (as is the case in your example).

  • 8
    Man, regex is pure magic. I don't think I'll ever grok it :) Aug 20, 2014 at 7:35
  • 14
    Make sure that the flag to have . match newlines is off.
    – Taemyr
    Aug 20, 2014 at 9:00
  • 3
    In case it's potentially a tab instead of a space, you can use [ \t].*
    – Cornstalks
    Aug 20, 2014 at 18:13
  • 4
    @Cornstalks \s.* is shorter. Maybe even use \s+.*, to match an arbitrary amount of whitespace, now that we're coding defensively.
    – Anko
    Aug 22, 2014 at 13:32
  • 1
    @jpmc26 as long as you don't say "regex" and "simple" in one sentence :) Aug 22, 2014 at 18:26

If you are using Windows and if you don't mind trailing spaces (you can find/replace them afterwards), use the Block Select feature:

  1. Press and Hold the Alt key
  2. Using the mouse, select the portion to delete (the entire block of text)
  3. Release the Alt key
  4. Delete that block of text
  5. Repeat as necessary
  • Is that supposed to be the minus "-" key?
    – Dracs
    Aug 19, 2014 at 23:11
  • Sorry - I used LT and GT brackets around 'alt' key. Fixed now. Aug 19, 2014 at 23:26
  • 10
    You can change it to <kdb>Alt</kbd> and it will format it as a key.
    – Dracs
    Aug 19, 2014 at 23:27
  • I've been using Notepad forever....and never knew this feature existed! 1 Bazillion +1!!!!!
    – user248279
    Aug 22, 2014 at 22:00
  • 1
    The OP said: "Column mode is not an option" Aug 23, 2014 at 18:52

A regular expression is quicker, but you can do some really tricky things with macros if it is a more complicated task.

You could record a macro:

  1. Cursor on line 1
  2. Hit Start recording
  3. Press key home
  4. Hold Ctrl while you press key Right arrow (seven times)
  5. Hold Shift while you press key End
  6. Press key Delete
  7. Press key Down arrow
  8. Hit Stop recording

Then play it back:

  1. Hit "Run a macro multiple times"
  2. Type in the lines of the document minus 1, since the first line is complete.

Place cursor after

Place cursor

Press Alt, and drag the cursor to right and down to select the unwanted part.


Press Backspace or Delete.


  • 1
    All this time using Notepad++ and I never knew it had a "Block Select Mode" like TextPad.
    – Kev
    Aug 23, 2014 at 2:25
  • @Kev: it works the same way in Visual Studio. Aug 23, 2014 at 18:51
  • 1
    The OP said: "Column mode is not an option" Aug 23, 2014 at 18:54
  • @PeterMortensen - re:VS - hell, been using that since 2002 and didn't even know!
    – Kev
    Aug 23, 2014 at 22:08

Here are a couple of alternative methods to the given answer.

If you data is fixed width, you can also use the following regular expression in the search:

Find what: ^(.{16}).*$

Replace with: \1

It is great if the data you want to keep does contain a space, as someone mentioned. Additionally, again for fixed width data, you can use Column Mode Editing. It's a neat little feature that allows you to edit multiple lines of data in the same column location. See Column Mode Editing.

It makes mention of arrow keys, but you can also use Page Up/Down for a faster method, as well as End and Home keys. The mouse also works. But you could use this for an ad hoc method of deleting data after a certain point, especially if it is only a few lines. It is also good for copying data, but the way it pastes is a bit odd, so you'd want to get used to that first.

  • 1
    Better than selecting it and replacing it with itself would be to use a lookbehind like: (?<=^.{13}).* and replace it with nothing. This will select anything after the first 13 characters. Aug 21, 2014 at 15:37

Similar to enthdegree:

  1. Place cursor at column 16
  2. Shift + Alt + Page Down
  3. Shift + Alt + End
  4. Delete

If there is a blank line at the end of the file, simply press Up Arrow prior to #3.

It's not perfect, but it's handy.

  1. Press ALTwhile using the mouse as a lasso.
  2. Select all you want to remove
  3. Press DELETE
  • Assuming the first column lines up nicely, like IP addresses, then this is the quickest way.
    – bgStack15
    Aug 20, 2014 at 14:46
  • The OP said: "Column mode is not an option" Aug 23, 2014 at 18:53

Here is a visual way:

  • Put cursor at end of an IP address.
  • Alt+Shift+Pg Down
  • Alt+Shift+Right
  • Delete

This is not 'column based.' It only works because your IP addresses all line up.

  • 1
    What do you mean by "This is not 'column based.'"? Alt+Shift+Arrow switches to "column mode".
    – MrWhite
    Aug 20, 2014 at 15:27
  • It doesn't respect tab-delineation as a column. It breaks them up into spaces so that each line in the selection has the same # of chars beyond the edge of the selections starting point. Aug 20, 2014 at 15:31

In regular expression mode, search for:


And replace with


  • Can you add a sentence or two to explain what this does? Thanks.
    – fixer1234
    Dec 30, 2014 at 21:55
  • 1
    Stack Exchange converts tabs to spaces while displaying, but even in edit mode, the example does not show any tabs.
    – Arjan
    Dec 30, 2014 at 22:22
  • Thanks this worked excellent in my case. Therefor upping!
    – Joanne
    Dec 12, 2019 at 10:31

Delete everything after first column in Notepad++:

  1. Selcect the 2nd column : Alt + Drag
  2. For selecting rest columns: simply press Right Arrow

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .