:range s[ubstitute]/pattern/string/cgiI | |
For each line in the range replace a match of the pattern with the string where: | |
c | Confirm each substitution |
g | Replace all occurrences in the line (without g - only first). |
i | Ignore case for the pattern. |
I | Don't ignore case for the pattern. |
:1,5s/java/scala/g
選取第1行到第5行,並將其中所有的java取代成scala
:%s/java/scala/g
選取全檔,並將其中所有的java取代成scala
:%s/[Rr]uby/Python/g
選取全檔,並將其中的Ruby和ruby都取代成Python
沒有留言:
張貼留言