Tuesday, 28 January 2025

vim global search replace

 https://www.baeldung.com/linux/vim-search-replace

To search and replace all occurrences on every line of the file, we need to slightly modify the previous command:

:%s/article/tutorial/g

The symbol lets us access all the content in the file, and we can replace all occurrences in each line.

The sample.txt file should match this after replacing all occurrences:

No comments:

Post a Comment