Discussion Locked

Vi editor

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Can I append the contents of a file say a.txt to the end of another file say b.txt which have opened in Vi

5 replies

by les

yes.

vi b.txt

go to the end of the file (shift + g)

type O for a new line, then press escape to get back to command mode,

type in :r a.txt

(This says read the contents of the file and insert them at the current cursor position.)

note the file must be in the current directory or you should give the full pathname - :r /home/a.txt)

This discussion is closed to new replies.