/
Parse as Fixed Length directive
Parse as Fixed Length directive
The PARSE-AS-FIXED-LENGTH directive parses a column as a fixed length record with widths for each field specified.
Syntax
parse-as-fixed-length :column width[,width]* ['padding']
Usage Notes
Fixed-width text files are special cases of text files where the format is specified by column widths, pad characters, and left or right alignment. Column widths are measured in units of characters.
For example, if you have data in a text file where the first column always has exactly 10 characters, the second column has exactly 5, the third has exactly 12, and so on; this would be categorized as a fixed-width text file.
If not defined, the padding
character is assumed to be a space character.
Example
Using this record as an example:
{
"body": "12 10 ABCXYZ"
}
Applying this directive:
parse-as-fixed-length :body 2,4,5,3
results in this record:
{
"body": "12 10 ABCXYZ",
"body_1": "12",
"body_2": " 10",
"body_3": " ABC",
"body_4": "XYZ
}
, multiple selections available,
Related content
Parse as CSV directive
Parse as CSV directive
More like this
Parse as JSON directive
Parse as JSON directive
More like this
Trimming Spaces directive
Trimming Spaces directive
More like this
Cut Character directive
Cut Character directive
More like this
Parse XML to JSON directive
Parse XML to JSON directive
Read with this
Split to Columns directive
Split to Columns directive
More like this
Created in 2020 by Google Inc.