hadoop getfile exercise
来源:互联网 发布:红警mac版 迅雷下载 编辑:程序博客网 时间:2024/05/16 11:26
#!/bin/sh
#Hostname Prefix
localPath="/work/tda/yunion/unionfactfile"
hadoopPath="/workspace/tda/yunion/thive"
hadoop="/opt/hadoop-1.0.3/bin/hadoop"
hive="/opt/hadoop-1.0.3/hive/bin/hive"
#格式化日期.
function formatDate()
{
d=$1
echo `echo ${d}|awk '{print substr($0,1,4)"-"substr($0,5,2)"-"substr($0,7,2)}'`
}
#设置全局变量.
export hadoop=${hadoop};
export hive=${hive}
fdate=`date -d yesterday +%F`
date=`date -d yesterday +%Y%m%d`
if [ $# -eq "1" ]
then
date=$1
fdate=`formatDate ${date}`
echo $date $fdate
fi
N=0;
N2=0;
cd $localPath
rm -rf ${date}; mkdir -p ${date}
for file_tmp in `${hadoop} fs -ls /workspace/tda/yunion/thive/*|grep f_ |grep ${date} `;do
let "N++"
if [ $(($N%8)) == 0 ]
then
let "num++"
echo $file_tmp
for file in `${hadoop} fs -ls ${file_tmp}/* |grep 000`;do
let "N2++"
if [ $(($N2%8)) == 0 ]
then
fileName=`echo $file |awk -F"/" '{print $6}'`
fileName1=`echo $fileName|awk '{printf("%s",tolower($0))}' `
echo $num ".." $file $fileName1
#/tudou/pvOutput/20120109/searchnum/part-00000
${hadoop} fs -cat ${file} |awk -F"\t" '$1=='${date}'{print $0}' |awk -F"\t" '$NF>0 && $0 !~/\\N/ && $0 !~/"/{print $0} ' >> ${date}/${fileName1}
fi
done
fi
done
#tar czvf ${date}.tgz ${date}/
#sz ${date}.tgz
- hadoop getfile exercise
- URL.getFile()
- Exercise
- exercise
- Exercise
- exercise
- CFtpConnection::GetFile和使用实例
- URL的getFile()方法的乱码问题
- Exercise 4.2 Exercise 4.3
- hadoop fs -put 上传文件遇到错误2 hadoop fs -put /opt/exercise/ds.txt ds.txt
- Exercise------------ProgUseJava
- Exercise 1.16
- exercise 1.17
- exercise 1.19
- exercise CombinationNoNeighboring
- exercise permutation
- Exercise: WindowsAzureRoleCommunicationVS2010Lab
- python exercise
- lock_kernel 内核上锁,即锁定0号进程
- 网站的易用性测试如何进行?都包括哪些内容?
- web前端技术进展
- Unity3d Shader(三) Pass(Color, Material, Lighting )
- 存储系统----存储技术(1)
- hadoop getfile exercise
- java package
- Eclipse 4.2修改空格和"="自动上屏的问题及常用配置
- Unity3d Shader(三) Pass(Culling & Depth Testing)透明立方体
- Oracle在过程或函数中清空表
- javascript面向对象编程(三)
- 三角函数
- Unity3d Shader(三) Pass(Texturing)混合纹理(同时显示2张图),自发光
- Linux 下的动态库小记