2010.03.04

Grepping though things

02.01.09 - Mark

I've been aware of GREP for years. I sort of remember it as a feature in BBEdit Lite, the great program I really learned HTML with, but always made do with the regular, plain english search and replace commands to fix problems. That stayed true when I finally moved to TextWrangler (after it was released as freeware to fully replace BBEdit Lite).

I also knew GREP or sometimes referred to as Regular Expressions, was in Perl and PHP, saw it on XKCD, both as a comic and as a t-shirt. Probably knew it was available at the command line of OS X and Linux. Those references and bits of knowledge made me aware of it, but it wasn't until earlier this year that I was given a task that I probably could have hacked though it with traditional search and replace, but needed enough changes made that I felt it would probably take less time to learn how to use a bit of regular expressions.


Regular-Expressions.info helped me a lot, but it still took a little longer to figure out than I had guessed. However, it was well worth the effort, over and over the GREP has proven to be very helpful, and while I'm not a master of the syntax, I can do a bit of damage with it in Textwrangler without a cheat sheet.

About two weeks ago, I stepped up to using some grep in a PHP script.

I've been off and on reading Rockwood Comic for years, but it's lack of an RSS feed sort of pushed it back further. The odd thing is I remembered a bit about scraping websites to create RSS feeds. While there are plenty of tools out there that will do the same thing, part of me figured it would be simpler, more precise and up to date, and a fun little challenge to create it myself - at least for that comic site. Plus once it was kicking around in my head, I knew I'd be using GREP in PHP to dig out some of the content. Once I think it's working a bit better I'll think about writing another post on the hack, especially since this post is mostly rambling on about how wonderful a tool GREP is for geeks, and that I created an RSS feed for Rockwood Comic using PHP, GREP, and cron to write the RSS file it, all wrapped up in Feedburner to give it a prettier URL than the sandbox address my code resides at.

Link | 0 Comments |





Feedback for Grepping though things

No Comments (Yet)



Leave Feedback on Grepping though things

Name:
Site:    http://
Email:

Comment: