BDO TOOLS  -  Organise Fields Manage Folders Remove Duplicates

Example 2

Each line of the input file in this example contains 14 fields and each line of the output file will be written with 8 fields. Seven fields from each line of the input file are to be written to each line of the output file, but with changed field positions.

 Input Field  Output Field
 1 8
 2 2
 3 3
 - - -
 116
 127
 134
 145

In addition, an 8th field is also to be written to each line of the output file, positioned as field 1 of each line of the output file because field 1 is the sole unallocated output field position. As the Quoted control is not selected, the first field of each line of the output file will be unquoted. Also, because the Increment control is selected for this field, and the Contents box is not empty, an incremental value, determined by the number of lines of text that the input file contains, will be appended to the contents of the Contents box.

For an input file that contains 42 lines, therefore, this example will result in the first field of the first line of the output file containing the value 101 and the first field of the last line containing 142. Similarily, for an input file containing 1,204,973 lines, this example will result in the first field of the first line of the output file containing the value 10000001 and the first field of the last line containing 11204973.

To write an incremental field starting at 1, select the Increment control and leave the Contents box empty.



Using the settings shown above with an input file containing 780,432 lines of text, where the first 3 lines are:


 insert into writers values ("W 00001", "Adami", "Giuseppe", "", "", "", "", "", "", "", "1878", "1946", "Puccini", "Turandot");
 insert into writers values ("W 00002", "Anelli", "Angelo", "", "", "", "", "", "", "", "1761", "1820", "Donizetti", "Don Pasquale");
 insert into writers values ("W 00003", "Apel", "Johann", "", "", "", "", "", "", "", "1771", "1816", "Weber", "Der Freischütz");

the Organise Fields tool will produce an output file, the first 3 lines of which will be:

 insert into writers values (1000001: `Adami`:  `Giuseppe`: `Puccini`:   `Turandot`:       `1878`: `1946`: `W 00001`);
 insert into writers values (1000002: `Anelli`: `Angelo`:   `Donizetti`: `Don Pasquale`:   `1761`: `1820`: `W 00002`);
 insert into writers values (1000003: `Apel`:   `Johann`:   `Weber`:     `Der Freischütz`: `1771`: `1816`: `W 00003`);

Note

If the Table Name box had been empty, the first 3 lines of the output file would be:

 (1000001: `Adami`:  `Giuseppe`: `Puccini`:   `Turandot`:       `1878`: `1946`: `W 00001`);
 (1000002: `Anelli`: `Angelo`:   `Donizetti`: `Don Pasquale`:   `1761`: `1820`: `W 00002`);
 (1000003: `Apel`:   `Johann`:   `Weber`:     `Der Freischütz`: `1771`: `1816`: `W 00003`);
 
Copyright © 2018 Brian D. Ogilvie www.bdozone.com  :