Monday, 25 November 2013

Find and Replace Command in vi Editor

Goal: VI / Vim Basic Find and Replace

To find each occurrence of 'ipphone', and replace it with 'IP_Phone', enter (press ESC, type : and following command):
:%s/ipphone/IP_Phone/g

Goal: Find and Replace with Confirmation

Find a word called 'ipphone' and replace with 'IP_Phone', but ask for confirmation first, enter:
:%s/ipphone/IP_Phone/gc

Goal: Find and Replace Whole Word Only

Find whole words exactly matching 'ipphone' to 'IP_Phone'; and ask for confirmation too:
:%s/\/IP_Phone/gc

Goal: Case Insensitive Find and Replace

Find 'ipphone' (match ipphone, ipphone, ipphone, ipphone and so on) and replace with 'IP_Phone':
:%s/ipphone/IP_Phone/gi

Same command with confirmation:
:%s/ipphone/IP_Phone/gic

Goal: Case sensitive Find and Replace

Find each 'ipphone' and replace with 'bar':
:%s/ipphone/bar/gI

Same command with confirmation:
:%s/ipphone/bar/gIc

1 comment:

  1. Jadwal Daftar Sabung Ayam SV388 15 Februari 2019 di Situs Judi Sabung Ayam Online Melalui Agen Resmi Taruhan Sabung Ayam Live Asli Thailand.

    Jumat, Banten 15 Februari 2019 – Pada Hari Tersebut Akan Di Laksanakan Berbagai Pertandingan Sabung Ayam Secara Live di Arena Sabung Ayam Thailand.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete