DtoLine - D-file to Line format conversion.

[ English | Japanese ]

[visit D-home]

SYNOPSIS

DtoLine [ -f field-format-list ] [ -p field-format-list ] [ -t default-delimiter ] [ -z default-options ] [ input-file.. ]

DESCRIPTION

DtoLine converts D-records in the input-files into lines of a plain text file. By default, DtoLine generates a line from an input D-record, concatenating value part of the fields with the default delimiter (Tab). All fields of the input record appear in the output line, keeping the field sequence of the input record.

The default delimiter and the output format options can be changed with -t and -z options.

When a -f field-format-list option is given (but no -p option), field values are converted through the given format. Note that -f option does not select fields, nor change the field sequence.

When a -p field-format-list option is given, only listed fields appear in the output line, in the order listed. When a listed field is not in the input record, null string is assumed for the field. When a listed field appears more than two in the record, those fields are output repeatedly. When no listed field is found in the record, null line (a line with length zero) is produced. Same field name may repeat in the list. Same value is repeated as you have listed.

OPTIONS

-f field-format-list
gives the output formats for the fields.
-p field-format-list
gives the field names, their order and formats to be converted.
-t default-delimeter
gives the default delimiter for the field-format-list. Default value is control character TAB.
-z default-options
gives the default options (lrqxQbf). Default value is none.
-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

Csv File

Output .csv file (without field name line):

DtoLine -t , -z q

(Assuming all records have same field sequence without repeating fields. You may use -p option to ensure the field order, but still without repeating fields.)

With format specification (-f option)

Command:

DtoLine -f "b://,c:/;/,a:/:/"

Input:

a:A1
b:B1
c:C1
d:D1

a:A2
c:C21
b:B2
c:C22

Result:

A1:B1C1;D1
A2:C21;B2C22

Extracting a Field (-p option)

Command:

DtoLine -p recordcount

Input:

recordcount:1
fieldcount:3
charcount:37

Result:

1

Creating UNIX /etc/group file entries

Command:

DtoLine -t ":" -f "user:/\,/"

Input:

groupname:sys
passwd:
gid:3
user:root
user:bin
user:sys
user:adm

Result:

sys::3:root,bin,sys,adm

DIAGNOSTICS

See the manual of D_msg.

SEE ALSO

Dintro, DfromLine, DtoTex, DtoCsv, D_fmt, D_msg.

AUTHOR

MIYAZAWA Akira


miyazawa@nii.ac.jp
2003