Files
lk/data/interactive_string_substitution.md
2026-04-16 15:04:58 +02:00

20 lines
416 B
Markdown

---
title: "Interactive String Substitution"
tags: [ "data", "vim", "substitution", "replace", "TUI" ]
---
Want to find and replace, but also confirm each instance?
```sh
vim -c "%s/${pattern}/${replacement}/gc" -c 'wq' ${file}
```
Notice that double-quotes (`"`) in the first command (`-c`).
Alternatively, check with an example string:
```sh
sed "s/${pattern}/ARGLEBARGLE/g" ${file} | grep 'ARGLEBARGLE'
```