1st Dan needed to delete the names. The delimiter is the first space. So delete everything from the first space to end of line:
s/ .*$//
To delete the emails, a 2nd Dan is needed. Delete any non-space and the first space from the beginning of the line:
s/^[^ ]* //
Note: This answer assumes, that the delimiter is a single space character. If the delimiter between the email and the name is a <tab>
or multiple spaces or any combination of it, we have to move to the 3rd Dan:
s/\s.*$//
This deletes from the first whitespace (be it a space or a tab) till the end of line.
s/^\S*\s\+//
This deletes from the beginning of the line (^
) all non-whitespace characters (\S*
) including the following one or more whitespaces (\s\+
).
See :help /\s
, :help /^
and :help /\+
.
Now ranges:
The simplest case is if you want to act on the entire file, just use %
like:
:%s/ .*$//
If it is only a part of the file, the easiest way is to visually select the lines and then hit :
and enter one of the substitution commands from above.