scripts in vi

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: G.D.Thurman
Date:  
Subject: scripts in vi
On Thu, 27 Jun 2002, Greg wrote:

> For example a script that would insert a date into a document.
>

+ Press ESC (i.e. make sure 'vi' is not in an insert-mode)
+ Go to the spot in your file where you want to insert
the output of a command.
+ Execute the command using the 'r'ead command as follows...

:r !date

Example:

I'm using 'vi' right now at
Thu Jun 27 10:08:49 MST 2002

---

What is :r !date ?

Enter into colon : mode (also know as 'ed' mode)
and execute the 'r'ead command followed by ! and
then a command-line.