线下班第二期 Bash 教程

问题收集贴,访问testerhome帖子列表,找出所有大于3个赞的帖子

代码

http://www.gnuplot.info/

echo '1
3
2
4
6' | gnuplot -e "set terminal dumb;plot '<cat' using 1 with lines"
ids=`curl https://testerhome.com/topics 2>&1 | grep -o 'href="/topics/[0-9]*"' | awk -F '/|"' '{ if($4 !=a) {print $4}}'`;
for id in $ids;     do url='https://testerhome.com/topics/'$id;     zan=`curl $url 2>&1 | grep -o -m1 '<span>[0-9]*' | awk -F '>' '{if($2>3){print $2}}' `;         if [ -n "$zan" ]; then echo $url '   点 赞人数' $zan  ;fi; done | awk -F '/' '{print $NF}'  | gnuplot -e "set term png; plot '<cat' using 1:3 with lines" > 1.png
关闭