wget to standard out

By Hal Canary, 2004-02-12 23:35:59 (link)
#computers-code

#!/bin/sh
#DTPD#
## ~/bin/wgeto ##
exec wget -o /dev/null -O - "$@"

Then,

$ wgeto http://craphound.com/ebooksneitherenorbooks.txt \
     | fold -s -w 70 | less 

Explanation for non-unix-literate people: First of all, I wrote a neat script called wgeto. wget is a program that downloads stuff off of the internet, via http or ftp. wgeto calls wget, but tells it to ignore the progress dialog by sending it to the null device, "-o /dev/null". (See Rule of Silence from The Art of Unix Programming.) wgeto then pipes the document into standard output.

I pipe it through fold to wrap long lines

Then I pipe it into a pager, less, so that I can page through the document.

Now I don't have to save a copy on the hard disk.


(back)