Rdb: Ruby-Nachbau der MWC /rdb-Werkzeuge
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
.TH listtosh "" "" "/rdb Command"
|
||||
.PC "Convert list format to shell variable"
|
||||
\fBlisttosh < \fIlist\fR
|
||||
.PP
|
||||
.II "list^convert to shell"
|
||||
.II "convert list to shell"
|
||||
The command
|
||||
.B listtosh
|
||||
converts a list-format file (\fIcolumn\fB<tab>\fIdata\fR)
|
||||
to a shell variable format
|
||||
(\fBVARIABLE='\fIvalue\fB'\fR).
|
||||
You can use this to move a record into a shell variable.
|
||||
.SH Example
|
||||
Consider file
|
||||
.BR maillist :
|
||||
.DM
|
||||
Number 1
|
||||
Name Ronald McDonald
|
||||
Company McDonald's
|
||||
Street 123 Mac Attack
|
||||
City Menphis
|
||||
State TENN
|
||||
ZIP 30000
|
||||
Phone (111) 222-3333
|
||||
.sp \n(pDu
|
||||
Number 2
|
||||
Name Chiquita Banana
|
||||
Company United Brands
|
||||
Street Uno Avenito De La Revolution
|
||||
City San Jose
|
||||
State Costa Rica
|
||||
ZIP 123456789
|
||||
Phone 1234
|
||||
.DE
|
||||
.PP
|
||||
The command
|
||||
.DM
|
||||
eval `row 'Number == 2' < maillist | listtosh`
|
||||
.DE
|
||||
.PP
|
||||
transforms the mailing list into the following format:
|
||||
.DM
|
||||
Number='2'
|
||||
Name='Chiquita Banana'
|
||||
Company='United Brands'
|
||||
Street='Uno Avenito De La Revolution'
|
||||
City='San Jose'
|
||||
State='Costa Rica'
|
||||
ZIP='123456789'
|
||||
Phone='1234'
|
||||
.DE
|
||||
.PP
|
||||
Once this is done, test the transformation by typing:
|
||||
.DM
|
||||
echo "$Name's phone number is $Phone."
|
||||
.DE
|
||||
.PP
|
||||
This writes the following on the standard output:
|
||||
.DM
|
||||
Chiquita Banana's phone number is 1234.
|
||||
.DE
|
||||
.SH "See Also"
|
||||
.B
|
||||
tabletolist
|
||||
.R
|
||||
.SO listtosh
|
||||
Reference in New Issue
Block a user