#このキーJSONの値は、戻り値があるかどうかを確認します。いいえNULLを返します。 #2つのパラメータを渡し、$ 1 $ 2は全体のラインJSONで、キー名です。 fun_col(){ エコー $ 2 > COL1 COL = ` 猫 COL1 | grepの $ 1 | トイレ - 'L' であれば [$ COL =!0 ]; その後、 値 = ` 猫 COL1 | awkの -F " $ {1} \":" ' {$ 2印刷} ' | awkの -F ' ' ' {$ 1を印刷} ' ` エコー" $値" 他の 値 = \\ N エコー" $値」 されます #上記のエコーリターンはAとなっています #戻り値$ } #実行を保存されたすべてのファイルを空。 > test.txtの date_yesterday = ` 日は -d " 1日前" + " %Y-%M-%D " ` #オリジナルのログを合わせ、最後にJSONファイルを取得 猫 e_charger_user_other_service $ {date_yesterday} .logに。| grepの " 获取用户信息成功" > ログ_ $ {} date_yesterday 猫のログ| grepの " GETINFO]、結果" | awkの -F ' "データ":' ' {$ 2印刷} ' | awkの -F ' "情報":」' ' {$ 1印刷} ' > データ_ $ {} date_yesterday .json しばらく読み取りライン DO IDNO = `fun_col IDNO $ line` idPicBack = `fun_col idPicBack $ line` idPicFront = `fun_col idPicFront $ line` idtype = `fun_colのidtype $ line` isIdChecked = `fun_col isIdChecked $ line` isInternalEmployee = `fun_col isInternalEmployee $ line` isOrderCharge = `fun_col isOrderCharge $ line` isPayPwdSet = `fun_col isPayPwdSet $ line` 電話 = `fun_col電話の$ line` 本名 = `fun_col本名$ line` regChannel = `fun_col regChannel $ line` regTime = `fun_col regTime $ line` 性別 = `fun_colセックスの$ line` トークン = `fun_colトークン$ line` updateTime = `fun_col updateTime $ line` userId = `fun_colのuserId $ line` userState = `fun_col userState $ line` USERTYPE = `fun_col USERTYPE $ line` 自分の変化に応じて、区切り文字#\ 001区切り文字。 エコー " $ {IDNO}?$ {idPicBack}?$ {idPicFront}?$ {のidtype}?$ {isIdChecked}?$ {isInternalEmployee}?$ {isOrderCharge}?$ {isPayPwdSet}?$ {電話}?$ {本名}?$ {regChannel}?$ {regTime}?$ {性別}?$ {トークン}?$ {updateTime}?$ {userIdを}?$ {userState}?$ {USERTYPE} " >> test.txtという 行なわ < DATA_ $ {date_yesterday} .json #}そして両側に、最終的な文字列データ型の除去"" sedの -i 'がS /} // ' test.txtの セッド -i ' S / \「// G ' test.txtの ミュージックビデオデータ$ {_} date_yesterdayあるtest.txt .TXT #アップロードは、HDFSの適切なディレクトリに.txtファイルを掃除しました。 HadoopのFS -put -fデータ_ $ {date_yesterday} .txtの/user/hive/inceptor/user/hive/warehouse/default.db/gwddc_admin/test_json/