File tree Expand file tree Collapse file tree 1 file changed +20
-10
lines changed
Expand file tree Collapse file tree 1 file changed +20
-10
lines changed Original file line number Diff line number Diff line change 88fi
99echo ${MONTH}
1010R_MONTH=${MONTH#* _} ; R_MONTH=${R_MONTH# 0}
11- BATCH=" cd fb-public-results\nls -1 cvid_responses_${MONTH} *.gz"
12- sftp -b <( echo -e " ${BATCH} " ) -P 2222 fb-automation@ftp.delphi.cmu.edu 2> /dev/null | \
13- grep " ^cvid" | \
14- awk -F_ ' BEGIN{print "cd fb-public-results"} {key=$3 $4 $5; if (key!=last && last!="") {print record} last=key; record=$0} END{print record}' | \
15- sed ' /^cvid/ s/^/get /' > fetch.sftp
16- sftp -b fetch.sftp -P 2222 fb-automation@ftp.delphi.cmu.edu
17- OUT=${MONTH/ _/ -}
18- Rscript ../monthly-files.R ${MONTH% _* } ${R_MONTH} . > ${OUT} .csv
19- gzip ${OUT} .csv
20- sftp -b <( echo -e " cd fb-public-results\nput ${OUT} .csv.gz" ) -P 2222 fb-automation@ftp.delphi.cmu.edu
11+
12+ perform_rollup_and_post ()
13+ {
14+ BATCH=" cd $1 \nls -1 cvid_responses_${MONTH} *.gz"
15+ sftp -b <( echo -e " ${BATCH} " ) -P 2222 fb-automation@ftp.delphi.cmu.edu 2> /dev/null | \
16+ grep " ^cvid" | \
17+ awk -F_ -vDIR=" $1 " ' BEGIN{print "cd " DIR} {key=$3 $4 $5; if (key!=last && last!="") {print record} last=key; record=$0} END{print record}' | \
18+ sed ' /^cvid/ s/^/get /' > fetch.sftp
19+ sftp -b fetch.sftp -P 2222 fb-automation@ftp.delphi.cmu.edu
20+ OUT=${MONTH/ _/ -}
21+ Rscript ../monthly-files.R ${MONTH% _* } ${R_MONTH} . > ${OUT} .csv
22+ gzip ${OUT} .csv
23+ sftp -b <( echo -e " cd $1 \nput ${OUT} .csv.gz" ) -P 2222 fb-automation@ftp.delphi.cmu.edu
24+ rm -rf $1
25+ mkdir $1
26+ mv * .gz $1 /
27+ }
28+
29+ perform_rollup_and_post " fb-public-results"
30+ perform_rollup_and_post " protected-race-ethnicity-data"
You can’t perform that action at this time.
0 commit comments