Commit dcfea73c authored by Russell D's avatar Russell D

Commit Bash Parser

parent ead6187a
# .v 1
# reverting to bash, awk, sed for text parsing and comparison
#date format
dr=$(date +%M)
#run the crawler
scrapy crawl gainspider -o /home/redcloud/cryptodl/CMC/top1/out.json 2>&1 | /dev/null
#parse the output
cat /home/redcloud/cryptodl/CMC/top1/out.json | grep -i title > /tmp/CoinCol
cat /home/redcloud/cryptodl/CMC/top1/out.json | grep -i Per > /tmp/PerCol
cat /home/redcloud/cryptodl/CMC/top1/out.json | grep -i vol > /tmp/VolCol
#paste the files
paste /tmp/CoinCol /tmp/PerCol /tmp/VolCol > /tmp/results.txt
#Display results
echo -en "Major Gainers \n"
cat /tmp/results.txt | head -30 | awk -F\" '{ printf "%-8s %-8s %s\n", $4, $8, $12 }' | grep \$[0-9].......
echo -en "\n\n"
#echo -en "Top 30 Gainers\n"
#cat /tmp/results.txt | head -30 | awk -F\" '{ printf "%-8s %-8s %s\n", $4, $8, $12 }'
echo "saved in "results$dr""
#clean up old files
rm -rf /tmp/CoinCol
rm -rf /tmp/PerCol
rm -rf /tmp/VolCol
mv /tmp/results.txt "/tmp/results$dr"
rm -rf /home/redcloud/cryptodl/CMC/top1/out.json
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment