Files
rdb/man/enter.man
T

258 lines
6.4 KiB
Groff

.TH enter "" "" "/rdb Command"
.PC "Add rows to a table or list file without an editor"
\fBenter [\-\fIlimit\fB] \fItableorlist\fR
.PP
.II "row^append"
.II "table^add row"
.II "table^append row"
.II "append row"
.II "add row"
The command
.B enter
is a simple way to append one or more rows to the end of
.IR tableorlist .
It displays each column name and waits for you to type each item.
.PP
.B enter
is a substitute for the form-editor
.BR ve .
It is easier to use, but very limited.
.PP
Note that this is one of the few
.B /rdb
commands that does not use the less-than symbol `<'
to input a table,
but requires the name of a table to which it is to append data.
.PP
If you make an error in entering a record, you can return to the last
line by typing a caret `^';
.B enter
then prompts you with the previous line.
If you return two lines, keep typing carets
until you are prompted for the line you wish to reenter.
.SH Options
The option \fB\-\fIlimit\fR
lets you limit the number of rows to be entered.
For example, \fB\-1\fR prompts for one row and then exits.
Thus, it can be used in a shell script.
.SH Rules
To set up and enter a file in list format instead of table format, there
are several rules and suggestions.
.PP
First, let's discuss terminology.
A list is like a table that is turned sideways.
For example, a wide table looks like this:
.DM
Number Name Company Street City State ZIP
Phone
------ ---- ------- ------ ---- ----- ---
-----
1 Ronald McDonald McDonald's 123 Mac Attack
Memphis TENN 30000 (111) 222-3333
.DE
.PP
Note that the row is so long that it wrapped around to the next line.
Also, the column names and column data do not line up.
.IR Names ,
.IR Companies ,
and
.I "Street Addresses"
are usually too long to fit nicely into such a table.
Therefore, we need a list format like this:
.DM
Number 1
Name Ronald McDonald
Company McDonald's
Street 123 Mac Attack
City Memphis
State TENN
ZIP 30000
Phone (111) 222-3333
.DE
.PP
These two formats (table and list) are made interchangeable by using two
programs:
.B listtotable
and
.BR tabletolist .
You can enter and keep a file in list format.
When you want to use several commands,
you can convert it to table format and pipe it into the regular
commands for faster execution.
For example, the command
.DM
listtotable < maillist | column Name Phone | justify
.DE
.PP
produces the following output:
.DM
Name Phone
--------------- --------------
Ronald McDonald (111) 222-3333
.DE
.PP
It is best, therefore, to remember that
.B Name
and
.B Phone
are column names.
The information that follows them in the list
is the first row of a table (that can be created by the command
.BR listtotable ).
.IP "\fB1.\fR"
First use an editor to create the list file.
Type each column name followed by one, and only one, tab.
Also enter the information for the first row (record).
.IP "\fB2.\fR"
Be sure to put a newline (blank line)
as the first line of the file.
.IP "\fB3.\fR"
Be sure to put a blank line at the end of each row (record).
In the previous example, it should appear after the row
.BR Phone .
This tells the program that it has reached the end of the row.
.sp \n(pDu
You can then save the file and use the
.B enter
program.
Type:
.DM
enter maillist
.sp
Name _
.DE
.sp \n(pDu
.B enter
responds with the first column name and
a tab, and waits for you to enter whatever you wish for
.BR Name .
The underscore `_' shows where the cursor
of your terminal will be waiting for you to input data.
.IP "\fB4.\fR"
Type in your data for the item.
Use the return key to end the information for this item.
If you type more than 80 characters or so, your terminal will wrap around.
You can continue to type and wrap around until
you reach your editor's line limit or press \fB<Return>\fR.
Then
.B enter
gives you the name of the next column head,
a tab, and waits for your entry.
.IP "\fB5.\fR"
When
.B enter
has given you the first
column name of a new record and is waiting for a response,
exit from it by typing \fB<ctrl-D>\fR.
.B enter
then returns you to the COHERENT shell.
.sp \n(pDu
For list-formatted files, it is better to use the
.B enter
command than an editor.
If you do your entry with a text editor,
you must include all of the column names,
in the same order and spelled correctly.
.SH Example
To add a line to file
.BR maillist ,
type the following:
.DM
enter maillist
.DE
.PP
The editing session may go as follows:
.DM
Number 2
Name Chiquita Banana
Company Standard Brands
Street ^
Company United Brands
Street Uno Avenido de la Reforma
City San Jose
State Costa Rica
ZIP 123456789
Phone 1234
.sp
Name \fB<ctrl-D>\fP
.DE
.PP
Note we made an error entering
.B Company
and did not realize it until we were at
.B Street.
We typed a caret `^' that reprompted us for
.BR Company ,
which we then reentered.
.B enter
then went on to prompt us for
.B Company
again.
.PP
The entered file now appears as follows:
.DM
Number 1
Name Ronald McDonald
Company McDonald's
Street 123 Mac Attack
City Memphis
State TENN
ZIP 30000
Phone (111) 222-3333
.sp
Number 2
Name Chiquita Banana
Company United Brands
Street Uno Avenido de la Reforma
City San Jose
State Costa Rica
ZIP 123456789
Phone 1234
.DE
.PP
Note that the last row (actually eight lines and the bottom
newline) is the one we entered.
Just press \fB<Return>\fR if you have no data to enter after a prompt.
.PP
Now for an example of \fBenter\fRing a table.
If you want to add a line to
.BR inventory ,
type:
.DM
enter inventory
.sp
Item# Amount Cost Value Description
------- ------- ------- ------- ---------------
.DE
.PP
Then start typing your rows.
Remember to insert tabs between columns:
.DM
8 123 5.98 0 widget
9 29 15.50 0 another widget
\fB<ctrl-D>\fP
.DE
.PP
The inventory file now looks like this:
.DM
Item# Amount Cost Value Description
------- ------- ------- ------- ---------------
1 3 5.00 0 rubber gloves
2 100 0.50 0 test tubes
3 5 8.00 0 clamps
4 23 1.98 0 plates
5 99 2.45 0 cleaning cloth
6 89 14.75 0 bunsen burners
7 5 175 0 scales
8 123 5.98 0 widget
9 29 15.50 0 another widget
.DE
.PP
Note that the last two lines are the ones we entered.
.SH "See Also"
.B
listtotable,
tabletolist,
ve
.R