structure.txt is a tab-separated
structured text file. json.txt
contains non-structured JSON strings. We need to join the two files to create a
new file result.txt. The original
data is as follows:
structure.txt
Json.txt
Result.txt
esProc will first import json.txt as a structured table sequence and then join it with structure.txt. The code is as follows:
A1:
Import the JSON file into the memory as a table sequence.
A2: Retrieve name column and cluster column from it. #1 represents the first column. Result is as follows:
A3: Split cluster column into two parts, name them key and value respectively and thus generate a structured data object. Result is as follows:
A4: Import
the structured text file.
A5: Perform join operation. _2 represents A4’s second column. Result is as follows:
A6,B7: Retrieve
desired columns and export them to result.txt.
No comments:
Post a Comment