yestoday=`date -d "1 day ago" +"%Y-%m-%d"` yestoday="2016-06" /apps/svr/mongodb/bin/mongo --host 192.168.1.135 --port 27017 ws_shop_pos --eval "var host='192.168.1.135', dbname='ws_shop_pos',yestoday='"$yestoday"'" /apps/export_kettle/export-goods-bill.js |awk '{if(NR>3) print $0}' > ./goods_bill/goods_bill_$yestoday.csv mysql --skip-column-names -h192.168.1.136 -uws_shop_pos -pws_shop_pos_2015 ws_shop_pos -e "use ws_shop_pos;LOAD DATA LOCAL INFILE '/apps/export_kettle/goods_bill/goods_bill_${yestoday}.csv' INTO TABLE bill_goods_detail_20166 \ FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (shop_id,store_id,flow_no,goods_code,goods_name,number,price,amount,create_time,source_type);"
js 脚本
var time=yestoday db.bill_goods_detail.find({'createTimeStr':{$regex:time}}).forEach( function(x){ print([ x['shopId'], x['storeId'], x['flowNo'], x['goodsCode'], x['goodsName'], x['number'], x['price'], //x['hyCouponNos'], //x['wxCouponNos'], x['amount'], x['createTimeStr'], '27017' ] ); })
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于