#!/bin/bashread offset hdfs_file
echo -e "$offset\t$hdfs_file"# Retrieve file from HDFS to local diskecho"reporter:status:Retrieving $hdfs_file" >&2
/Users/sun1/repo/hadoop-3.1.2/bin/hdfs dfs -get $hdfs_file .
# Create local directorytarget=`basename $hdfs_file .tar`mkdir $targetecho"reporter:status:Un-tarring $hdfs_file to $target" >&2
tar xf `basename $hdfs_file` -C $target# Unzip each station file and concat into one fileecho"reporter:status:Un-gzipping $target" >&2
for file in $target/*
dogunzip -c $file >> $target.all
echo"reporter:status:Processed $file" >&2
done# Put gzipped version into HDFSecho"reporter:status:Gzipping $target and putting in HDFS" >&2
gzip -c $target.all | /Users/sun1/repo/hadoop-3.1.2/bin/hdfs dfs -put - /GSOD_ALL/$target.gz
rm `basename $hdfs_file`rm -r $targetrm $target.all