2008-10-31

Html Grep

Ever wanted to grep through the page contents and extract only interesting tags like all meta tags? Or maybe you wanted to print out contents of a tag with given id?

Now it's simple: html grep.

Usage is: htmlgrep.rb selector (file or url). It also accepts STDIN

Examples:


htmlgrep.rb input "http://www.google.com/"
cat index.html | htmlgrep.rb "div#users"
htmlgrep.rb "div#users" index.html

2 comments:

Anonymous said...

I just wrote the exact same program, and when I was about to add it to my list of utilities it occurred to me to ask google if it already existed. Thanks!

Reuben said...

Great. Perhaps give a direct download link, list the dependencies, and put the usage info in comments into the script?