Vim text manipulation

  question, vim

clipboard.png

Excuse me: How can I use the relevant operations in vim? The content form circled by value reservation is:
 
 logRequest
 userId: 0
 UpdateNickName
 userId: 10034
 CommonUserData
 userId: 10034

Please tell me the detailed steps, thank you.

utilizevimThe regular replacement function of command mode can be realized.

Sample text:

aaaaaaaaaa logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 aaaaaaaaaa logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 aaaaaaaaaa logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 aaaaaaaaaa logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 aaaaaaaaaa logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 aaaaaaaaaa logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034

Step 1::%s/.*logRequest/logRequest/g
The implementation results are as follows:

logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034
 logRequest UpdateNickName bbbbbbbbbbbbbbb userId: 10034

Step 2::%s/\w\+ userId/userId/g
The results are as follows:

logRequest UpdateNickName userId: 10034
 logRequest UpdateNickName userId: 10034
 logRequest UpdateNickName userId: 10034
 logRequest UpdateNickName userId: 10034
 logRequest UpdateNickName userId: 10034
 logRequest UpdateNickName userId: 10034