Created
April 17, 2018 07:55
-
-
Save pyar6329/2e4f0afb537ebc1e9a545acd34e683bb to your computer and use it in GitHub Desktop.
download Japan Self-Defense Forces daily report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 要 gnu-grep, pget | |
set -eu | |
case "$(uname -s)" in | |
"Darwin") | |
cpu_cores=$(system_profiler SPHardwareDataType | grep "Total Number of Cores:" | awk '{print $NF}') | |
;; | |
"Linux") | |
cpu_cores=$(cat /proc/cpuinfo | grep "cpu cores" | wc -l) | |
;; | |
esac | |
download_lists=$(curl -s https://www.asahi.com/articles/ASL4J669JL4JUEHF016.html | ggrep -Po '(?<=href\=").+\.pdf' | sort | uniq) | |
multi_process=10 | |
echo $download_lists | xargs -P $multi_process -n 1 pget -p $cpu_cores |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment