質問

Basically I want to do the following replacement using vi:

Apple->Orange
apple->orange
APPLE->ORANGE

Is there any way to do it in one line?

役に立ちましたか?

解決

You can use sed command

$ cat os.txt
BEST
UNIX
Unix
uNiX

Sed supports "i" or "I" for "case insensitive" search and replacement
$ sed 's/unix/BEST/i' os.txt
BEST
BEST
BEST
BEST

If you need to use vi try this command

1,$ s/apple/orange/gI
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top