How to save a file under a different name in vi

I often edit a file in vi

, and I want to save it under a different name than the name I opened in it.

I tried to keep the following: :w >> new_file_name

but I ALWAYS get it E212: Can't open file for writing

.

What's the right way?

+3


source to share


2 answers


:w filename

      



Saves the file name

+8


source


Enter :w filename

vi in ​​command line mode, for example @Yedidia said ...

I think you are confusing writing the output of the output to a file.

What will be the next command to create or rewrite text.txt

:



 action > text.txt

      

and to add the command output to text.txt it will look like this:

action >> text.txt

      

+1


source







All Articles