Dbundle [ -k key-flags] key-field-list [ input-file.. ]
Dbundle bundles the input files with key-field-list key values. Bundling is a D-file operation to make a record, grouping same key value records. The new record has a set of key fields and other fields of all the records in the group. For example, there are three records of same "key" field value A.
key:A
oth:1
key:A
oth:2
key:A
oth:3
Bundling with field "key" makes the following record.
key:A
oth:1
oth:2
oth:3
All the fields of the first record is appeded to the output, then all but the key fields of other records are copied to the same output record.
A record is grouped when the key value is same as the previous record. Usually (but not necessarily), input file is sorted by the key order.
Command
Dsort word:fd words.d | Dbundle word
creates a D-file for word index printing, from the input file "words.d" like:
page:1
word:Dfile
page:1
word:bundling
......
Result will be
page:1
word:bundling
page:...
page:1
word:Dfile
page:...
......
To eliminate duplicate records (like uniq):
Dsort "^" | Dbundle "^"
See the manual of D_msg.
MIYAZAWA Akira