重複の可能性:
Vim:sは、1行の最初のN < gエントリを置き換えます。
n
viで "hello"という単語の最初の項目を検索して置換し、次のm
項目はにbonjour
、残りはすべてに置き換えるにはどうすればよいですかnamaste
?
ベストアンサー1
n番目の「hello」を手動で見つけることができますか?その場合は、次のようにn番目のhelloを探します。
:1 (goes to the first line of your file)
n/hello (find the nth hello, where n is the number)
次に、すべてのhellosを次のように置き換えます。
:1,.s/hello/bonjour/g
(move to the next line)
:.,$s/hello/namaste/g