Discoveries With TextWranglerSometimes you discover a solution that completely resets your expectations of what's possible. This week I found TextWrangler's Shebang menu. TextWrangler is a free, Mac OS X-based text editor from Bare Bones software. It's packed with a number of very handy features that it inherited from BBEdit Lite (which I've already raved about). TextWrangler adds in new features, particularly syntax coloring, to make it even more useful for both programming and web-oriented writing. I spend lots of time getting data--like this week's Annual Report Card (ARC) research--in shape to post online. Hefty spreadsheets of text and numbers have to be combed through, cleaned up, combined with other documents and reformatted into html elements or Java arrays to wind up on the Web. It's a pain, and prone to mistakes. So I use regular expressions, search-and-replaces, and tools like Perl and BBEdit Lite to get it done. But now I've got TextWrangler, and shebang. Shebang refers to the two characters: #! that start Unix scripting files. With TextWrangler's #! menu, you can run scripts (Perl, Python, or shell) inside your text. So what? Here's an example: I needed to merge the list of this year's ARC companies with the full list of previous ARC companies, sort them, and throw out the duplicates. I pasted this year's list into a TextWrangler window, followed by the master list of all companies. In the shebang menu, I found the choice "Eliminate Duplicates and Sort a List". And it did, instantly. But the best tool is one that lets you build your own tools, and TextWrangler doesn't disappoint--I'm able to add my own scripts to the shebang menu to solve my specific text cleanup problems. Like this one: Now I have my unique companies list: Enterasys Fujitsu Gateway HP Hayes Hitachi Hyperion IBM ... and so on. To turn this into an html 'select' menu, I need to wind up with this: <option value="Enterasys">Enterasys</option> <option value="Fujitsu">Fujitsu</option> <option value="Gateway">Gateway</option> <option value="HP">HP</option> <option value="Hayes">Hayes</option> <option value="Hitachi">Hitachi</option> <option value="Hyperion">Hyperion</option> <option value="IBM">IBM</option> With each company name appearing twice, with other text before, between, and after the company names. I can do this with a Perl script like this one: #!/usr/bin/perl Notice the shebang? It's easy enough to run this in a Terminal window, but you'll need to go compare the output to the input to see if it worked the way you wanted. The advantage of running this in TextWrangler is this: You see the changes, in place, in your document, as you're watching. This is a huge help, particularly in more complex cases--situations where you want to add some text, delete text, change text and keep other text in a document untouched. Watch the changes as they happen. Don't like the result? A character off somewhere in your script? A quick Undo and the damage is undone. Edit your script and try it again. This will save hours of time. But that's not the only new feature of TextWrangler I'm enjoying. I can open up a group of TextWranger documents into one window, and use key shortcuts to go back and forth through them. When working on an article with numerous 'pieces', it's much easier to flip through pages left and right, somehow, than it is to go through separate windows, or up and down inside one long document. It sounds like a simple thing, and it is, but for me, this minor convenience has been a big boost to my creativity. (Though I'd love to see a 'next sentence' key command--maybe I can shebang that myself...) TextWrangler's not a full html editor--BareBones Software has BBEdit for that, though I'm also partial to jEdit, particularly when I'm going back and forth between Windows and Mac. But if you push text around in a serious way, TextWrangler's a mini miracle. Page through the ARC scorecards for a taste. Posted by Joe Caponi at 04:13 PM, October 13, 2006 This is a public forum. United Business Media and its affiliates are not responsible for and do not control what is posted herein. United Business Media makes no warranties or guarantees concerning any advice dispensed by its staff members or readers. Community standards in this comment area do not permit hate language, excessive profanity, or other patently offensive language. Please be aware that all information posted to this comment area becomes the property of United Business Media LLC and may be edited and republished in print or electronic format as outlined in United Business Media's Terms of Service. Important Note: This comment area is NOT intended for commercial messages or solicitations of business. |
Go To The New Hot Topics HomeBy Joe CaponiManaging Editor, Operations, ChannelWeb Email Joe Recent Entries Hot Topics' New Home Archives By Categories
Archives By DateMarch 2009 Powered by: |