Rhea
Rhea

Reputation: 3

Replacing the first word on each line in Vim

I have a file that looks like this:

aaaaaaaaaaa bbbb ccccccc
dddd eeeeeeeee ffffff

and for each line I would like to replace the first word with "text":

text bbbb ccccccc
text eeeeeeee ffffff

Upvotes: 0

Views: 2459

Answers (1)

padawin
padawin

Reputation: 4476

You can use the following regex:

:%s/^\w\+/text/

\w is a word character.

Upvotes: 10

Related Questions