lk/data/interactive_string_substitution.md

398 B

title, tags
title tags
Interactive String Substitution
data
vim
substitution

Want to find and replace, but also confirm each instance?

vim -c "%s/${pattern}/${replacement}/gc" -c 'wq' ${file}

Notice that double-quotes (") in the first command (-c).

Alternatively, check with an example string:

sed "s/${pattern}/ARGLEBARGLE/g" ${file} | grep 'ARGLEBARGLE'