Ded - D-file stream editor

[ English | Japanese ]

[visit D-home]

SYNOPSIS

Ded [ options ] Dl-program [ input-file.. ]
Ded [ options ] [ -f Dl-program-file ].. [ input-file.. ]

DESCRIPTION

Ded is a Dl processor. It reads D-records from the input files and execute the given Dl program for eacvh input D-record. After execution, (possibly modified) the current record is written to the standard out unless the current record is null value.

After processing all records from the input file, Ded once again executes the Dl-program without any input record. This is called epilogue mode, and in this mode, no automatic output is made after the execution. Epilogue mode is usually used for the termination process like output of accumulated result. It is also useful for generating new D-file from the null input file. Use OUTPUT special variable to make an output in the eilogue mode. In the Dl program, epilogue mode can be tested by EPILOGUE special variable.

OPTIONS

-f Dl-program-file
Dl-program is not taken from the command argument but from the Dl-program-file. This option is repeatable. When repeated, program files are concatenated to form a program.
-F
"filename" field is added to the output.
-D [i/o]datautf=8|16|32
UTF I/O feature (see manual page of UTF I/O feature.)

ENVIRONMENT

Ddatautf, Didatautf, Dodatautf
for UTF I/O feature.

EXAMPLES

Adds a field "foocount" which holds the number of "foo" fields in the same record.

Ded foocount = COUNT foo

Delete "count" field when the field is not non negative integer.

Ded IF count UNLIKE "^[0-9]+$" THEN count = { } FI

Create D-file with 10 records of which field "seq" is 1 to 10.

Ded FOR i IN 1 .. 10 DO seq = VAR i ; OUTPUT DONE < NUL

Note that this program runs only in the epilogue mode, because no record comes in from NUL file (it should be /dev/null in the UNIX).

Read a D-file like:

title:Introduction to D
price:2400

title:D tutorial
price:2800

........

and appends a summary record with a field "price.sum" after the whole file.

Ded -f prog.dl input-file

where prog.dl file contains:

IF EPILOGUE THEN FIELD price.sum = STATIC sum ; OUTPUT FI ;
IF NR == 1 THEN STATIC sum = 0 FI ;
STATIC sum = STATIC sum + FIELD price

Note that Dmeans does more neat job for similar purpose.

FIXED NAME FIELDS

filename:
at the top of each record, when -F options is provided.

DIAGNOSTICS

See the manual of D_msg.

SEE ALSO

Dl, Dselect, Dintro,

AUTHOR

MIYAZAWA Akira


miyazawa@nii.ac.jp
2003-2007