Skip to content

Instantly share code, notes, and snippets.

@veryyoung
Last active September 1, 2016 09:13
Show Gist options
  • Select an option

  • Save veryyoung/0e39db2335afa2eda90ef5fe4163e72d to your computer and use it in GitHub Desktop.

Select an option

Save veryyoung/0e39db2335afa2eda90ef5fe4163e72d to your computer and use it in GitHub Desktop.
#!/sh/bash
###
### 查询当日 uv, 接收 yyyyMMdd 格式的参数, 默认日期为今天
###
LOG_PATH='/var/log/nginx/'
FILE_PREFIX='access.log-'
date=$1
if [ "$1" == '' ]; then
date=`date -d today +%Y%m%d`
fi
uv=`ls $LOG_PATH$FILE_PREFIX$date* | xargs zless | awk '{print $1}' | sort | uniq | wc -l`
echo "The uv of $date is $uv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment