Online Encyclopedia Shell Script For Linux And Unix
September 02, 2008 (6:30:00 PM) - 3 months ago
Share
a>
Print
Comments
Today's Linux/Unix bash shell script is a follow up (and the finishing touch, I hope ;) to a whole slew of scripts we've written to mine the knowledge on tap at reference.com. If you missed any of the others, you can still find them in our older bash script posts to access the online Thesaurus and, of course, the online dictionary. This time we're breaking the chains and losing the albatross by finally attacking (with some level of precision) the Online Encyclopedia and producing a shell script does it as much justice as we could muster.
Online Encyclopedia Shell Script For Linux And Unix
Posted by: Anonymous [ip: 128.146.242.37] on September 03, 2008 03:30 PM1) Run the output through fmt before outputting. It will wrap the paragraph text fairly nicely, although it kind of destroys tabular data, and the indenting can get weird, or
2) Use lynx with the -dump option instead of wget. I replaced the final wget command with
lynx -dump http://www.reference.com/search?q="$arg" |sed '1,/Cite This Source/d'|sed '/External links\|See also\|More from Wikipedia/,$d'|sed 's/\[[0-9]*\]//g'|$pager
and the result looks fairly nice.
#