vi
:%s/l/r/g
command line:
tr l r < in > out
سؤال
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 :)
المحلول
vi
:%s/l/r/g
command line:
tr l r < in > out
نصائح أخرى
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