Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
U-Boot SLB Linux Amiga OS Dual Boot Motherboards Peripherals Other
Initialisation Installation OS4 Updates About OS4 File Systems Networking Printing Other
Introduction File System Workbench Preferences Commands Error Msgs Miscellaneous

AmigaOS 4.0 - About OS4 - Commands

Format: EDIT [FROM] <filename> [[TO] <filename>] [WITH <filename>] [VER <filename>] [[OPT P <lines> | W <chars>] | [PREVIOUS <lines> | WIDTH <chars>]]
Purpose: To edit text files by processing the source file sequentially (a line editor).
Path: C:EDIT
EDIT is a line oriented text editor that can be used to process files sequentially under the control of editing commands. EDIT moves through the input, or source file, line by line making any changes and passing the result to the output, or destination file.

The argument FROM represents the source file that you want to edit. This must be a file that already exists.

The TO argument is the name of the destination file. This is the file to which EDIT sends the output including any editing changes. If you omit the TO argument, EDIT uses a temporary file and, when editing is complete, copies the temporary file to the original file, overwriting it.

The WITH argument allows you to specify a command file from which to get EDIT commands. Ordinarily, EDIT functions interactively, reading commands that you type from the keyboard. You may put EDIT commands in a file instead and have them executed automatically using the WITH argument to specify the command file.

The VER argument gives the name of the file to which EDIT will send error messages and line verifications. If you omit the VER argument EDIT will print its messages on the screen.

EDIT has the capability to move backward in the source file a limited number of lines. This is possible because EDIT doesn't write the lines to the destination file immediately, but instead holds them in an output buffer. The PREVIOUS argument specifies the number of lines that EDIT can move backwards in the source file.

The WIDTH argument sets the maximum line length that EDIT can handle. Together the PREVIOUS and WIDTH arguments determine the size of the buffer that EDIT will use (buffer size = PREVIOUS * WIDTH). Unless you specify otherwise, PREVIOUS is set to 40 and WIDTH to 120.

Here's a complete list of EDIT commands.

The list uses the following abbreviations:
t A string with delimiters (such as /any string/).
n Line number in source file; a period (.) refers to the current line in the source file, an asterisk (*) refers to the last line.
sw Switch (+ is on and - is off).
qs A string or a qualified string with delimiters. There are five qualifiers: B (beginning), E (ending), L (last), P (precisely), and U (uppercase). For instance the qualified string "B/any string/" matches "any string" if it occurs at the beginning of a line. The qualified string U/x/ will match either upper- or lower-case "x".

Positioning Commands
M n Move to line n.
M + Move to highest line in buffer.
M - Move to lowest line in buffer.
N Next line.
P Previous line.

Search Commands
F qs Find string qs.
BF qs Find string qs moving backward through source file.
DF qs Find string qs and delete any intervening lines.

Character Positioning Commands
< Move character pointer left.
> Move character pointer right.
# Delete character at pointer.
$ Lower case character at pointer.
% Upper case character at pointer.
- Turn character at pointer to space.
PA qs Position character pointer after qs.
PB qs Position character pointer before qs.
PR Reset character pointer to start of line.

Current Line Commands
A qs t Put string t after qs.
AP qs t Put string t after qs, position character pointer after t.
B qs t Put string t before qs.
BP qs t Put string t before qs, position character pointer after qs.
CL t Concatenate current line, string t, and next line.
D n Delete line number n; if a second number is given, delete from n1 to n2 inclusive; if no number is given, delete the current line.
DF qs Delete from current line to line containing qs.
DFA qs Delete from after qs to end of line.
DFB qs Delete from before qs to end of line.
DTA qs Delete from start of line to after qs.
DTB qs Delete from start of line to before qs.
E qs t Exchange string qs with string t.
EP qs t Exchange string qs with string t and position character pointer after t.
I n Insert material typed at keyboard before line n (type Z to terminate keyboard input).
I t Insert material from file t before the current line.
R n Replace line n with material typed at keyboard (type Z to terminate keyboard input); if a second line number is given, replace lines from n1 to n2 with new material.
R n t Replace line n with material from file t; if a second line number is given, replace lines from n1 to n2 with file.
SA qs Split line after qs.
SB qs Split line before qs.

Global Commands
GA qs t For each qs found as file is processed, place t after qs.
GB qs t For each qs found as file is processed, place t before qs.
GE qs t For each qs found as file is processed, replace qs with t.
CG n Cancel global n (cancel all if n omitted).
DG n Disable global n (disable all if n omitted).
EG n Enable global n (enable all if n omitted).
SHG Display info on globals used.

Text Verification Commands
? Verify current line.
! Verify with character indicators.
T Type to end of file.
T n Type n lines.
TL n Type n lines with line numbers.
TN Type until buffer changes.
TP Move to top of buffer then type lines to end of buffer.
V sw Set verification on or off.

File Commands
FROM t Take source from file t.
FROM Revert to original source file.
TO t Place output lines in file t.
TO Revert to original destination file.
CF t Close file t.

Other Commands
' Repeat previous A, B, or E command.
= n Set line number to n.
C t Take commands from file t.
H n Set halt at line n. If n is * then halt and unset H.
REWIND Rewind source file.
Q Exit from command level; windup if at level 1.
SHD Show data.
STOP Quit without saving changes.
TR sw Set or unset trailing space removal.
W Windup (exit saving changes).
Z t Set input terminator to string t.

Example 1:

3.OS4:> EDIT FROM program1 TO program1-new WITH my-edit-commands starts EDIT with program1 as the source file and program1-new as the destination file. The EDIT commands in the file my-edit-commands would be executed automatically as if they had been typed at the keyboard.

Example 2:

3.OS4:> EDIT FROM program1 PREVIOUS 50 WIDTH 240 VER ver-file starts EDIT with program1 as the source file. Any changes made with EDIT will be written back to this same file since the TO argument is omitted. The EDIT buffer is set up so that you can move back 50 previous lines. The line width is limited to 240 characters. All verification and error messages from EDIT will be sent to the file ver-file.

See Also: ED, MeMacs, Notepad

Return to Commands Selection

Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it.

Copyright 2006 Amiga Auckland Inc. All rights reserved.
Revised: February 9, 2006.