Stefan Fischerländer
Technisches SEO und digitale Strategie

Redirecting wget to STDOUT – now with Syntax Highlighting


Sometimes the simplest looking tasks can become complicated, especially when modern computers are involved. Today I tried to examine the source code of some RSS feeds. Safari shows me a very nice HTMLified version of the feed. Of course this is useful for most of the Safari users, but it can get in your way when you try to develop a RSS based web application. But any up-to-date computer geek has more than one browser installed, so I fired up Firefox and tried to access the feed. Wow, even Firefox tries to be smarter than me and redirects me to my Bloglines account. (I’m sure this is a feature I’ve activated some time ago, but have no idea how to switch it off.)

Having a nice command line at hand, there should be an easy way to look at an RSS feed, but wget displays just some crap, if I redirect its output to STDOUT. But wait, I forgot to make wget quiet. And really, now it works and it’s a very simple way to look at my RSS feeds: wget -q -O - | less

Update: There’s even a way to get syntax highlighting! If you’ve installed a reasonably up-to-date version of vi(m), there is a script called in your $VIMRUNTIME directory, which acts as an replacement of less providing syntax highlighting.

To use this script on Mac OS X Tiger, you just have to follow these simple steps:

Launch vi and type :echo $VIMRUNTIME. This shows you the path to the vi files. On my MacBook this is /usr/share/vim/vim62. Now execute sudo ln -s /usr/share/vim/vim62/macros/ /usr/bin/vless. If you’ve got another path before, you have to edit this command appropriately. That’s all. Now vless acts nearly as less with syntax highlighting. Of course, vless can also be used within shell pipes: wget -qO- | vless