Dfill [ options ] field-list [ input-file.. ]
Dfill fills empty fields listed in the field-list with values from the preceding non-empty records. Dfill is used, not necessarily, but usually with DfromHtml or DfromCsv to process tables. In the following examples, D-records are shown in their corresponding table forms.
In some tables, empty field means ditto. For example:
|
|
The left table, naturally, shows rate from October 2008 to March 2009. For the corresponding D-record, the second and third records should be filled with year:2008, and the fifth and sixth records should be filled with year:2009.
Dfill year
does this operation.
Empty field here means that there is no such field (null value) in the record, or the field value is a null string (all values are null string when the field is repeated). But, with -b option, only null values are regarded as empty.
The field-list may have more than one field. In this case, by default, the field order in the list gives hierarchy. Change in the superior field value cancels the subordinate field value. For example:
|
|
Here, given the field-list year,month, the fifth record's month field is left empty (whtaever it means), while the fourth record is filled with year:2008 and month:12, the sixth record is filled with year:2009. (Of course, the second record is filled with year:2008 and month:11, the third record is filled with year:2008).
If you don't want hierarchical filling, and want to fill fields independently, use tandem Dfill, with individual field as the field-lists.
Dfill field-a input-file | Dfill field-b
Another case of filling field-list is aggregate value fields invoked by -a option. With this option, any change of listed fields is regarded as a new value. For example:
ISBN | ISSN | tag | value |
---|---|---|---|
0028-0836 | title | Nature | |
description | v. 1- Nov. 4, 1869- | ||
publisher | [London, etc., Macmillan Journals Ltd., etc.] | ||
0131101633 | title | The C programming language | |
author | Brian W. Kernighan, Dennis M. Ritchie | ||
publisher | Englewood Cliffs, N.J. : Prentice-Hall, c1978 |
This table will be filled with Dfill -a ISBN,ISSN as follows.
ISBN | ISSN | tag | value |
---|---|---|---|
0028-0836 | title | Nature | |
0028-0836 | description | v. 1- Nov. 4, 1869- | |
0028-0836 | publisher | [London, etc., Macmillan Journals Ltd., etc.] | |
0131101633 | title | The C programming language | |
0131101633 | author | Brian W. Kernighan, Dennis M. Ritchie | |
0131101633 | publisher | Englewood Cliffs, N.J. : Prentice-Hall, c1978 |
The field order of the output record follows the shortest common super-sequence of the records -- the record which provide the filling field value, and the record to be filled. However, when the number of fields in the record is too big (either record has more than 512 fields, or the product of the number of fields is greater than 65536), filling fields come first and the other fields in the filled record follow.
See the manual of D_msg.
MIYAZAWA Akira