Created
August 10, 2015 15:56
-
-
Save serverwentdown/91dcdbb67f972f9d9935 to your computer and use it in GitHub Desktop.
Downloads the Wikipedia article and parses it for the first paragraph as a summary
This file contains hidden or 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/zsh | |
SUMMARY=`curl -Ls "http://en.wikipedia.org/wiki/Special:Search?search=${*// /+}" | grep "<p>.*<\/p>" | head -n 1 | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | sed -E 's/\[[^>]{1,2}\]//g'` | |
echo -n $SUMMARY | |
if [ -n "$SUMMARY" ]; then echo; fi; | |
[ -n "$SUMMARY" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment