• Aucun résultat trouvé

Copying Text to Auxiliary Output Files

Dans le document PDP–11 Keypad Editor User’s Guide (Page 77-84)

For large cut and paste operations, you can make a copy of any part of the file you are editing and store it in a separate (auxiliary) output file. Then, you can insert all or part of the contents of that file (then called an auxiliary input file) in another part of the file you are editing.

If you want to split your file into two files, after creating and closing the auxiliary output file, simply delete the part of your file that you stored in the auxiliary file.

OUTPUT FILE KED

Commands and Functions

INPUT FILE AUXILIARY INPUT FILE

AUXILIARY OUTPUT FILE

MLO-003504

Although KED prevents you from changing a file while you are inspecting it, you can open an auxiliary output file, copy parts of the file you are inspecting to the auxiliary file, and close the auxiliary file without changing the file you are inspecting. Then you can edit the auxiliary file for another purpose and print it.

This chapter tells you how to:

• Open (create) an auxiliary output file that will contain the part you want to copy (Section 7.1)

• Select the part you want to copy and move that part to the auxiliary file (Section 7.2)

• Append more text to the auxiliary file (Section 7.3)

• Close the auxiliary file (Section 7.4)

• Purge (delete) the auxiliary file (Section 7.5)

Chapter 8 tells you how to insert all or part of the contents of your auxiliary file or another file in the file you are editing.

7.1 Opening (Creating) an Output File

When you open a file that does not exist, you are creating a new file.

You can open an auxiliary output file while you are creating, editing, or inspecting a file.

To open an auxiliary output file:

1. Press GOLD and COMMAND. 2. Type:

[OPEN] OUTPUT filespec

filespecis the file specification of a new file that will receive your text. Ensure that file specification does not duplicate another file specification. There is no default file type for auxiliary output files.

3. Press ENTER.

KED creates and opens the file you specified.

In other words:

GOLD COMMAND OUTPUT filespec ENTER

OUTPUT FILE KED

Commands and Functions

INPUT FILE

AUXILIARY OUTPUT FILE

MLO-003505

If you specify a file that already exists, KED signals you by sounding a beeper or reversing the text and background on your terminal and displays:

Auxiliary output file exists - Replace (Y,N)?

Type Y and press RETURN to delete the existing file and create a new output file with the same file specification. Type N and press RETURN to cancel your OPEN OUTPUT command.

You can use only one auxiliary output file at a time. If you issue an OPEN OUTPUT command to open a second auxiliary file without closing the first file, KED closes the first file (saving its contents in a separate file) and then opens the second auxiliary file. The first file is closed even when the OPEN OUTPUT operation for a second file is aborted; when, for example, you determine that a file specification for the second file already exists and you decide to stop the operation.

7.2 Selecting Text to Copy and Moving It to the File

You can use one of four WRITE commands to select the text you want to copy and to move that text to the auxiliary output file:

WRITE SELECT (Section 7.2.1) WRITE REST (Section 7.2.2)

WRITE number LINES (Section 7.2.3) WRITE number PAGES (Section 7.2.4)

In response to each command, KED starts with the character the cursor is on and copies all or part of the file you are inspecting, editing, or creating to the auxiliary output file. The text that KED copies is to the right of the cursor (and on lower lines). If you copied text with an earlier WRITE command, KED adds the new text at the end of the auxiliary output file.

7.2.1 WRITE SELECT Command

The WRITE SELECT command lets you use the SELECT function to select a section of text.

1. Move the cursor to the first character in the text you want to copy.

2. Press SELECT.

3. Move the cursor to the character following the last character in the text you want to copy.

4. Press GOLD and COMMAND. 5. Type:

WRITE SELECT 6. Press ENTER.

KED copies the selected text to the auxiliary file. Your original text remains intact.

In other words:

Select the text to be copied.

GOLD COMMAND WRITE SELECT ENTER

7.2.2 WRITE REST Command

The WRITE REST command selects all the text from the cursor to the end-of-file marker.

1. Move the cursor to the first character in the text you want to copy.

2. Press GOLD and COMMAND. 3. Type:

WRITE REST 4. Press ENTER.

KED copies the rest of the text to the auxiliary file. Your original text remains intact.

In other words:

Move the cursor to the first character in the text to be copied.

GOLD COMMAND WRITE REST ENTER

7.2.3 WRITE number LINES Command

The WRITE number LINES command lets you specify the number of text lines you want to select.

1. Move the cursor to the first character in the text you want to copy.

2. Press GOLD and COMMAND. 3. Type:

WRITE number [LINES]

numbercan be from 1 to 32767.

4. Press ENTER.

KED copies the selected text to the auxiliary file. Your original text remains intact.

In other words:

Move the cursor to the first character in the text to be copied.

GOLD COMMAND WRITE number ENTER

7.2.4 WRITE number PAGES Command

The WRITE number PAGES command lets you specify the number of pages you want to select. It uses the default definition of a page (all the text between form-feed characters) or the definition you created with the SET ENTITY PAGE command.

1. Move the cursor to the first character in the text you want to copy.

2. Press GOLD and COMMAND. 3. Type:

WRITE number PAGES

numbercan be from 1 to 32767.

4. Press ENTER.

KED copies the selected text to the auxiliary file. Your original text remains intact.

In other words:

Move the cursor to the first character in the text to be copied.

GOLD COMMAND WRITE number PAGES ENTER

7.3 Appending Text to the File

As long as your auxiliary output file remains open, you can select and copy as many sections of text as you like from anywhere in the file you are editing.

Each time you enter a WRITE command (Section 7.2), KED copies the text you selected and adds it to the end of the contents of your auxiliary file.

Once closed, however, that file cannot be reopened as an auxiliary output file. If you have more text to copy, you must open a second auxiliary output file (Section 7.1).

7.4 Closing the File

When you finish copying text to your auxiliary output file, you can close it by opening a second auxiliary output file (Section 7.1) or by issuing a CLOSE command.

1. Press GOLD and COMMAND. 2. Type:

CLOSE

3. Press ENTER.

KED closes your auxiliary file, saving its contents.

In other words:

GOLD COMMAND (CLOSE) ENTER

Once you close a file, you can no longer use it as an auxiliary output file, but you can use it as an auxiliary input file as described in Chapter 8.

7.5 Purging (Deleting) the File

If you decide you do not want to save your current (open) auxiliary output file:

1. Press GOLD and COMMAND. 2. Type:

PURGE

3. Press ENTER.

KED deletes the auxiliary file and cancels your last OPEN OUTPUT command.

In other words:

GOLD COMMAND PURGE ENTER

If you want to create (open) another auxiliary output file, you must issue another OPEN OUTPUT command.

7.6 Example

This section summarizes most of the information in this chapter by providing an example of all the steps necessary for copying text to an auxiliary output file. Each step has an instruction to complete and the keys you must type to complete the instruction.

1. Begin your work session to edit file WEEK.TXT.

EDIT WEEK.TXT RET

2. Use the OPEN OUTPUT filespec command to open auxiliary output file AUXOUT.TXT.

GOLD COMMAND OPEN OUTPUT AUXOUT.TXT RET

3. Use the WRITE number LINES command to copy the first two lines of WEEK.TXT to AUXOUT.TXT.

WRITE 2 LINES RET

4. Use the CLOSE command to close and save the contents of AUXOUT.TXT.

CLOSE RET

5. End your work session with the EXIT or QUIT command.

EXIT ENTER or

QUIT ENTER

Now you are ready to insert the contents of AUXOUT.TXT in file WEEK2.TXT, as described in the first example at the end of Chapter 8.

Chapter 8

Dans le document PDP–11 Keypad Editor User’s Guide (Page 77-84)