Skip to content

Instantly share code, notes, and snippets.

@blacknon
Created September 5, 2018 12:11
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 blacknon/ffed35811e8c78dfb0b71dc9c4654127 to your computer and use it in GitHub Desktop.
Save blacknon/ffed35811e8c78dfb0b71dc9c4654127 to your computer and use it in GitHub Desktop.
ジャンプの打ち切り漫画一覧取得のシェル芸
curl -s https://ja.wikipedia.org/wiki/%E9%80%B1%E5%88%8A%E5%B0%91%E5%B9%B4%E3%82%B8%E3%83%A3%E3%83%B3%E3%83%97%E9%80%A3%E8%BC%89%E4%BD%9C%E5%93%81%E3%81%AE%E4%B8%80%E8%A6%A7 \ |
sed -e 's/<span style="display:none[^>]*>[^>]*>//g;s/<td>/&__________/g;s|</ br>||g' | \
w3m -dump -cols 500 -T text/html | nkf -Lu | sed 's/__________/\x0/g' | \
grep -a -E '^ *[0-9]+ +' | grep -a -v -e '短期集中連載' -e '移籍' -e '連載中' -e '月1連載' -e '続編' | \
sed -r 's/^ *[0-9]+ +//g;s/\^\[[0-9]+\]//g;s/^\x0//g;s/ {2,}/\t/g;s|/[0-9]+||g' | \
awk -F"\0" '
BEGIN{OFS="\t"}
{
s=$(NF-2);
split(s, st, ".");
stx=st[1]*53+st[2];
e=$(NF-1);
split(e, en, ".");
enx=en[1]*53+en[2];
diff=enx-stx;
print $1,s,e,diff
}' | \
awk -F"\t" '$NF<53{print}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment