Shell Output into Vi
In VI editor you can get the output of any shell command command inserted into the file you are editing by using:
:r!<command>
For example:
:r!who -r
Inserts the ouput of the command "who -r" to the file currently being edited.
This can be effectively used to copy the contents of a file to the file currently being edited ie,
:r!cat /etc/passwd
Inserts all the contents of the the /etc/passwd to the file currently being edited.
Written by Francisco Reyes
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#