Editing Files with vi

If you want to use Minitab to analyze a data set which is too large to enter directly in Minitab then you might need to first enter the data into a file. We did this for you for the traffic data earlier in this handout, where we entered the data in the file ``traffic.data''. It is perfectly easy to enter data into a file by using the editor vi . As example, we will enter the following data:
   Active Exercise         Passive Exercise
   Group                   Group
   -----------------------------------------
    9.00                    11.00
    9.50                    10.00
    9.75                    10.00
   10.00                    11.75
   13.00                    10.50
    9.50                    15.00
   -----------------------------------------
The data gives the ages, in months, when children first walked by themselves. One group of children went throuh an ``active exercise'' program. The other group went through a ``passive'' program.

To enter the data use the vi command:

  vi baby.data  
  o  
  9.00 11.00  
  9.50 10.00  
  9.75 10000  
The command vi baby.data invoked vi to edit the file baby.data. Once within vi, the command o started instert mode. The next few lines enter rows of data into the file baby.data . On the last line a typo happened, so we want to exit insert mode, delete the line, and then continue to enter the data:
  [ESC]   
  dd  
  o 
  9.75   10.00  
  10.00 11.75  
The [ESC] command exits from insert mode (the [ESC] key is the key labeled F11). The dd command deletes the line in which the cursor is currently positioned (you can move the cursor around by using the arrow keys -- unless you are in insert mode). The o command gets us back into insert mode. The last two lines enter two more rows of data. Now continue to enter data until you reach the last rows:
  13.00 10.50  
  9.50  15.00   
  [ESC]  
The [ESC] command gets us out of insert mode. While dd and o let you delete and insert whole lines, you can use x and i to delete and insert character by character. Again, use [ESC] to get back out of insert mode. Also, you might want to sometimes use dw to delete a ``word''. Another important command: u will undo whatever was the last change you made -- try it out.

And finally, the :wq (think: write-quit) command saves the file and quits vi . Don't forget to type the colon before ``wq'':

  :wq  
Instead of :wq you could also use :q! to quit without saving. This will be helpful if you have hopelessly messed up the file and just want to leave the editor, restoring the file to its initial state.

Now you can start Minitab. From within Minitab you can then read the data into Minitab columns by using a command like read 'baby.data' c1 c2 .


If you edit a lot of files (e-mail, documents, data sets etc.) you should try out another editor: emacs . To start emacs type
	emacs
from the unix prompt. Then type
	C-h i t
to start an on-line tutorial ("C-h" stands for "control-h", i.e. press down the "control" key and the "h" key simultanuously).
peter@acpub
Last updated 12/1/95