Skip to content

Instantly share code, notes, and snippets.

@nakaly
Last active July 30, 2016 09:46
Show Gist options
  • Save nakaly/901c832199eaba58cf16dfefba3c7500 to your computer and use it in GitHub Desktop.
Save nakaly/901c832199eaba58cf16dfefba3c7500 to your computer and use it in GitHub Desktop.
青空文庫の文書リストcsvから全作品をダウンロードして、難易度を計算する
#!/bin/bash
while read -r line
do
url=`echo $line | awk -F ',' '{print $46 }' | sed -e 's/\"//g'`
curl -LOk $url > /dev/null 2>&1
if [ $? -ne 0 ]
then
continue
fi
file_name=`echo $url | awk -F '/' '{print $7}' | sed -e 's/\"//g'`
new_file_name=`echo $file_name | sed -e 's/zip/txt/g'`
unzip -c $file_name | nkf -w > $new_file_name
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment