w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
vim:search and replace a word in line beginning with a particular string

Use a backreference:

%s/(roads.*)Rome/1Italy/

Alternatively, say:

g/roads/s/Rome/Italy

(i.e. match lines containing roads and substitute Rome for Italy. This approach doesn't rely on the order in which the words appear in the line.)





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.