Skip to content

Instantly share code, notes, and snippets.

@iomz
Last active July 29, 2021 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iomz/dcbe4b643aee6e0759b0 to your computer and use it in GitHub Desktop.
Save iomz/dcbe4b643aee6e0759b0 to your computer and use it in GitHub Desktop.
# download http://scanningtheearth.org/data/[0-9]+
wget -q -O - http://scanningtheearth.org/data | grep "href=\"[0-9]\+\"" | sed "s/^.*href=\"//g" | sed "s/\".*$//g" | xargs -I {} wget -O {}.csv http://scanningtheearth.org/data/{}
## 対象のhtmlをダウンロードして、stdoutからpipeする
#wget -q -O - http://scanningtheearth.org/data |
#
## 数字のみを含むhrefがある行をまず抽出して、その前後をトリムする
#grep "href=\"[0-9]\+\"" | sed "s/^.*href=\"//g" | sed "s/\".*$//g" |
#
## できた数字の列からurlとファイル名をして出力
#xargs -I {} wget -O {}.csv http://scanningtheearth.org/data/{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment