#이 키 JSON의 값이 반환 값이 있는지 여부를 확인합니다. 어떤 NULL을 반환하지 않습니다. # 두 개의 매개 변수를 통과, $ 1 $ 2 전체 라인 JSON이며, 키 이름입니다. fun_col () { 에코 $ 2 > COL1 COL = ' CAT의 COL1 | 그렙 $ 1. | WC - l` IF [COL = $! 0 ] 그때 값 =' CAT의 COL1 | AWK -F " $ {} 1 \." " ' {2} $ 인쇄 ' | AWK의 -F를 ' , ' ' } {1 인쇄 $를. ' ' 에코 " $ 값 " 다른 값 = \\ N 에코 " $ 값 " 인터넷 리턴 에코 위 #은있다 # $ 반환 값 } 빈 저장 파일을 실행 당 #을. > TEST.TXT date_yesterday =` DATE는 -d " 1 일 회원 전에. " + " % Y-M- % D % " ` # 원래 로그 파일을 마지막으로 가지고 JSON의 일치 고양이 } e_charger_user_other_service의 date_yesterday을 {$ .LOG |. 그렙 " 가져 사용자 정보 성공적 " > 로그 _ $ {date_yesterday} 고양이 로그 | 그렙 "된 getInfo, 결과는 " | AWK -F ' "데이터 ": ' ' {$ 2 인쇄} ' | AWK -F ' " "정보는," ' ' {$ 1 인쇄} ' > _ $ {date_yesterday} .json 데이터를 하면서 읽기 라인을 할 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` realName = `fun_col realName $ 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` 유저 유형 = `fun_col USERTYPE $ line` # \ 001 구분 구분 자신의 변화에 따라. 에코 " $ {ID 번호}? $ {idPicBack}? $ {idPicFront}? $ {idtype}? $ {isIdChecked}? $ {isInternalEmployee}? $ {isOrderCharge}? $ {isPayPwdSet}? $ {전화}? $ {realname 없습니다 }? $ regChannel} {?} $ {regTime? 섹스} $ {?} $ {토큰? updateTime} $ {?} $ {userId를? userState} $ {?} $ {USERTYPE " >> TEST.TXT DONE < DATA_ .json date_yesterday} {$ #} 양쪽에 대한 최종 문자열 데이터 형식의 제거 "" Sed의 -i ' S /} // ' TEST.TXT Sed의 -i ' S / \ "// G 'TEST.TXT 뮤직 비디오데이터는 _이 .txt $ {date_yesterday있는 test.txt} # 업로드는 HDFS의 해당 디렉토리에 .txt 파일을 청소. FS 하둡 저것 집어 넣어 데이터 -f $ {_}가 .txt /user/hive/inceptor/user/hive/warehouse/default.db/gwddc_admin/test_json/ date_yesterday