Comment by metaphor
9 years ago
On a personal note, it doesn't require a compiler and doable on any barebones Linux box. Of course, this assumes that setup conditions as described are satisfied.
The non-artistic remark is subjective--I'm imagining those with a strong inclination towards regular expressions should find this fairly straight forward.
I write a lot of scrapers and parsers, and sed is great because it's fast and almost always pre-installed.
There's a script I use every day that takes the current date as an integer, calculates an offset, reads line of a Bible reading plan e.g. "Acts 19:1-20 Paul in Ephesus", gets the chapter number "Acts 19", and then links me to that file. I use sed to get the text between* the start and ":". I first wrote it in AppleScript on a Mac, but later I wanted to port it to a jailbroken iPhone. awk wasn't there, but sed was.
I also used sed for a Mac/Linux cross-platform script that scraped EPG data from MC2XML (information about TV guides). sed was faster than awk.
In practice these days I usually just use TextWrangler and find-replace with Regex, instead of writing a script.
* If you think you can do textBetween faster - please contribute your own implementation over on Rosetta Code.
http://rosettacode.org/wiki/Text_between
TextWrangler has now been sunsetted. :-(
https://www.barebones.com/products/textwrangler/
I know :(
I don't want to pay for BBEdit though, and I'm still on 10.9 so the compatibility hasn't caused problems for me yet.
1 reply →