Question

Is there any good Vim/Emacs/gedit shortcut to replace every certain character? Lets say I had the word "Hello, world!" and replace every 'l' character with 'r' so the statement would be "Herro, worrd!". I have a pretty big file to edit so I thought Vim or Emacs would have some fancy built in tricks to help me out :)

Was it helpful?

Solution

vi

:%s/l/r/g

command line:

tr l r < in > out

OTHER TIPS

Emacs:

alt-% l RET r RET

which calls the function query-replace, which you can call like this

alt-x query-replace RET l RET r RET
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top