我有一个包含以下数据的文件:
{ “PASSWORD_MATCH_RATE”: “0.00”, “PASSWORD_MATCH_COUNT”:0 “PASSWORD_INVALIDATE_SUCCESS_COUNT”:0, “NOTES”: “DFH”}
在猪脚本中我想转储数据如下:
PASSWORD_MATCH_RATE,0.00
PASSWORD_MATCH_COUNT,0
PASSWORD_INVALIDATE_SUCCESS_COUNT,0
注意,DFH
任何人都可以提供任何帮助吗?
答案 0 :(得分:0)
这将分割您的输入。你能试试吗?
A = LOAD 'file' using TextLoader() as (line:chararray);
F = FOREACH A GENERATE REPLACE(line,'"','') as (line1:chararray);
F1 = FOREACH F GENERATE FLATTEN(TOKENIZE(line1)) AS (line2:chararray);
F2 = FOREACH F1 GENERATE REPLACE(line2,':',',');