The term "column" means the whole text within a column, everything between one tab or return and the next. The things in parentheses with numbers after them are groups. This is still in code, to be sure, but a more English-like code, quite comprehensible once you know a few facts. How can gibberish be so powerful? If I had used Text Machine when I helped my friend prepare his file for import, I might have lost my honorary warlock status, upon giving my friend an AppleScript script that does the same thing (when executed, for instance, in Apple's own Script Editor): Grep School - Though I dearly love Nisus Writer's grep, I do admit that a certain portion of its satisfaction lies in the hocus-pocus factor. To many of us, that's a pleasure, not a problem but if you don't feel up to it, perhaps you'll want to wait for 1.1. But right now, Text Machine lacks an interface the only way to communicate with it is via scripting (typically, in AppleScript or Frontier's UserTalk). ![]() I've seen an alpha of this, and had a blast doing dialog-based grep find-and-replace within Eudora. But then things were derailed by Apple's abandonment of OpenDoc, and the dialog interface has been postponed to version 1.1. And indeed, that seems to have been PreFab's original plan - Text Machine was to be an OpenDoc part. Ideally, what you'd like is for Text Machine to put up a find-and-replace dialog, complete with pop-down menus so you barely have to learn any grep at all, and make changes directly in your application. It's a wonderful idea, but the best is yet to come. So you can command it remotely, and you can share grepping capabilities with less technically inclined colleagues who also own Text Machine, just by giving them a script. Text Machine is scriptable - that's how other applications talk to it. And Text Machine wants you to be able to grep successfully, so not only does it provide a powerful variety of grep, but also the commands that you give it are English-like, and much simpler to work with than grep's normal backslashy mess. You learn just one grep, Text Machine's then you call upon Text Machine from another application. The Text Machine concept is that of a universal grep utility. But PreFab Software is changing all that, with the release of Text Machine 1.0. And as if that weren't bad enough, different programs implement grep in different ways (my Nisus Writer example above would fail in BBEdit). Perhaps it's because the only way to grep is to own a word processor (or text processor) with a built-in grep facility, and then to learn to construct expressions which, unless you're a computer, are opaque to the point of illegibility. This friend was a perfect example of someone who needed to grep, but didn't know anything about it. My friend was stunned as I opened his file with Nisus Writer, asked it to find all instances of:Īnd calmly returned his file to him. The names had to be switched before the import took place. The problem? The database expected the last name first, first name second, and could not easily switch them. ![]() The file consisted of thousands of tab-delimited lines: For instance, someone once approached me with a text file that he wanted to import into an existing database. In the past, I have routinely amazed friends (and astounded enemies) with feats of greppy legerdemain, solving seemingly baffling text processing problems. Lots of everyday text-manipulation tasks turn out to be a snap with grep. Let's just let "grep" mean a certain kind of powerful text search or search-and-replace without which life as we know it would be impossible, or at least meaningless. Now that I have your attention, what on earth am I talking about? The fact that GREP originates as a Unix acronym for "global regular expression and print" need neither detain nor deter us. Yes, you! You may never have grepped before you may not even know what grepping is yet chances are good that within you too, inchoate and amorphous, has stirred a secret need to grep. One might be sitting next to you at this very moment.
0 Comments
Leave a Reply. |