We can do this Find and Replace task in Scripts using vi/vim editors.
Open your Script with vi/vim editor, then
:%s/WordToReplace/ReplaceWith/g
Finding and Replacing a word with Confirmation
:%s/WordToReplace/ReplaceWith/gc
Case Insenitive Finding and Replacing
:%s/OLD/new/gi
This will find all the words "Old, OLd,olD..." and Replaces with word "new"
Case Insensitive Find and Replace
:%s/OLD/new/gI
Find and Replace between L1 and L2 lines
:L1,L2s/OLD/new/g
Open your Script with vi/vim editor, then
:%s/WordToReplace/ReplaceWith/g
Finding and Replacing a word with Confirmation
:%s/WordToReplace/ReplaceWith/gc
Case Insenitive Finding and Replacing
:%s/OLD/new/gi
This will find all the words "Old, OLd,olD..." and Replaces with word "new"
:%s/OLD/new/gI
Find and Replace between L1 and L2 lines
:L1,L2s/OLD/new/g
Finding and Replacing only specific word
:%s/\<OLD\>/new/gc
No comments:
Post a Comment