PUT Command

Another way you can insert part of a file into another file is to use the PUT command. The PUT command lets you insert lines from a current file into a second file.

The PUT command stores a copy of a certain number of lines, starting with the current line. You can then append the stored lines to the end of another file.

The format of the PUT command is:

PUT number-of-lines filename filetype filemode

Filemode Note: It is necessary to specify the filemode if it is other than the default of = (equal to the file mode of the file you are currently editing).

The command puts the number of lines into the file you specify.

Another way to tell the editor how many lines you want to put is by typing a string. Remember the LOCATE command? When you learned about the LOCATE command, you searched files for a certain word or words—a string. You can also use a string with the PUT command. You can tell the editor to put all the lines, starting with the current line, up to but not including the line with the string.

To do so, use this command format:
PUT /string/ filename filetype filemode

Filemode Note: It is necessary to specify the filemode if it is other than the default of =.

Therefore, both PUT number-of-lines and PUT /string/ do the same thing.

Let us insert part of the STOCK INVEN file into CRIME THEFT.

Enter:
x stock inven
The file contains the following lines:
03469  GASKET          AA0306  9432
32554  RATCHET         AA0205  3762
32868  DOOHICKEY       BB0206  5248
64400  GIZMO           CC0101  9942
09263  WIDGET          AA0403  8645
60637  THINGAMABOB     BB0202  5432
26023  WHATCHAMACALLIT BB0306  9321

We are going to insert the first two lines of STOCK INVEN after the last line in CRIME THEFT. So make the first line of STOCK INVEN the current line.

Now enter:
====> put 2 crime theft
This command will append the lines
03469  GASKET          AA0306  9432
32554  RATCHET         AA0205  3762

to the bottom of the CRIME THEFT file.

Press PF3 to quit the STOCK INVEN file (leaving it unchanged).

Then enter
x crime theft

to view the new contents of the CRIME THEFT file.

CRIME THEFT now contains these lines:
Mort, Mort, the plumber's son,
Stole a cow and away he run.
The cow got loose and scared a goose,
And Mort got put in the calaboose.
03469  GASKET          AA0306  9432
32554  RATCHET         AA0205  3762

The lines you put in were inserted at the end.

At this point, you can delete the last two lines and enter FILE to return the file to its original form. Or, if you prefer, simply quit the file, leaving the additional lines you put in from STOCK INVEN.