12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- echo "开始执行output脚本"
- echo "删除rediskey.txt"
- rm -fr /home/it/middle_data/rediskey.txt
- echo "删除value.csv"
- rm -fr /home/it/middle_data/value.csv
- echo "删除result.csv"
- rm -fr /home/it/middle_data/result.csv
- echo "新建result.csv"
- touch /home/it/middle_data/result.csv
- echo "删除bad_name_list.txt"
- rm -fr /home/it/middle_data/bad_name_list.txt
- echo "新建bad_name_list.txt"
- touch /home/it/middle_data/bad_name_list.txt
- echo "删除good_name_list.txt"
- rm -fr /home/it/middle_data/good_name_list.txt
- echo "新建good_name_list.txt"
- touch /home/it/middle_data/good_name_list.txt
- echo "删除filtered_good_name_list.txt"
- rm -fr /home/it/middle_data/filtered_good_name_list.txt
- echo "新建filtered_good_name_list.txt"
- #touch /home/it/middle_data/filtered_good_name_list.txt
- echo "删除filtered_valus.csv"
- rm -fr /home/it/middle_data/filtered_valus.csv
- echo "新建filtered_valus.csv"
- touch /home/it/middle_data/filtered_valus.csv
- echo "删除pattern.txt"
- rm -fr /home/it/middle_data/pattern.txt
- cd /home/it/middle_data/
- pwd
- redis-cli -n 13 keys "*" > /home/it/middle_data/rediskey.txt
- echo "导出 key 完成"
- echo "开始读取 value"
- IFS_old=$IFS
- IFS=$'\n'
- for line in `cat rediskey.txt`
- do
- l=`redis-cli -p 6379 -n 13 llen $line`
- redis-cli -n 13 lrange $line 0 $l > /home/it/middle_data/x.txt
- tr -s "\n" "," < /home/it/middle_data/x.txt >/home/it/middle_data/x1.txt
- sed -i '$s/.$//' /home/it/middle_data/x1.txt
- val_middle=$(awk -v RS='\0' -F'1' '{print NF-1}' /home/it/middle_data/x1.txt)
- if [ $val_middle -ge 5 ]
- #if [ $val_middle -ge 4 ]
- then
- echo $line >> good_name_list.txt
- val=$(cat /home/it/middle_data/x1.txt)
- echo $val >> value.csv
- else
- echo $line >> bad_name_list.txt
- fi
- done
- IFS=$IFS_old
- redis-cli -n 13 flushdb
- echo "output脚本执行完成"
|