Search and replace using VIM function

Posted under » Linux on 19 Oct 2023

From basic VIM usage.

Search and replace is using the substitute command. See this also

:%s/#68A4C4/#A8B700/g

You can use function to replace. Go to prompt :

function! Tukar()
execute":%s/'role_ids'/$code64/g"
execute":%s/'editCurriculum'/$code65/g"
endfunction

You can also

:%s/\_s/^m/g #replace manual line break to ^m
:%s/<br>/\r /g #create line break

Then go to prompt :

:call Tukar()

If you don't want to use vim, you can also use sed with in-place replace

LC_ALL=C sed -i 's/[^\x0-\xB1]//g' multiple*.txt

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data