DfromLine [ options ] [ -t default-delimiter ] field-format-list [ input-file.. ]
DfromLine converts each line of input-files into a D-record. The conversion format and field names are given by the field-format-list. See the manual of D_fmt for the detail of field-format-list.
Read name, addreess and phone-number separated by TAB character from an input file named "directory":
DfromLine name,adddress,phone-number directory
Read passwd (5) file of UNIX:
DfromLine -t ":" "username,password,uid,\
gid,gcos-field,home-dir,login-shell" /etc/passwd
Read .csv file, with field name "a", "b" and "c"
DfromLine -t "," -z q a,b,c
(assuming the first line is not for the label).
Read above .csv file, but it may have newline in data, and mark them with "@@@":
DfromLine -t , -z q -c -n @@@ a,b,c
Input:
"separated
line",B,C
Output:
a:separated@@@line
b:B
c:C
Read words and literals from c source file
DfromLine -t "[^a-zA-z0-9_]+" -z qQb -c "wd:*" *.c
Read classic FORTRAN (not Fortran77) source on IBM 80 column cards (the first column is the comment mark, the columns 2-5 are line number, column 6 is for the continuation mark, columns 7-72 for source program and columns 73-80 are for the card identification):
DfromLine "comment:(1),number:1-4r,cont:(1),source:6-71,cardno:72-79"
Read a text file as a repeating field of each character:
DfromLine "char:*" *.txt
See the manual of D_msg.
MIYAZAWA Akira