|
Translate Quoted Comma Delimited to Fixed Width |
|
|
|
|
|
Suppose we wanted to translate the following quoted, comma-delimited data to fixed-width:
The first step in doing this is to parse all of the comma-separated fields onto separate lines. We could use the ReplStr filter to replace all commas (,) with carriage return / linefeeds, in-effect forcing all fields onto separate lines; however, any of the string fields could contain a comma (as for example, the name "Luther, Lex" in the second line) and therefore this isn't an ideal solution. A better approach is to use the ParseCSV filter instead. Sending the above data through the one-filter pipe,
outputs each field onto a separate line:
Adding 3 more filters to the pipe gives us:
The /U switch used by the QuoteLines filter is needed to unquote each line, (i.e. remove the outer quotes surrounding each line and then restore any embedded quotes). Finally, the parsed and unquoted fields are padded with blanks using PadLinesRight and then re-joined into fixed-width lines using JoinLines. The final output is:
For an example in which fixed-width data is translated to quoted, comma-delimited, see
here. |
|
|
[Home] [Contact Us] [Downloads] [Purchase/Register] |
|
|
Copyright © 2005 Firefly Software |
|