The other day we had to add additional text on top of each document. Actually what was needed is to add the GPL information into every source code file. Now, with an application that consists of about 6000 documents the tasks was to do this the simplest way possible.
Maybe some of us, were looking to far, but the solution was right at our hands. It was no additional application, it was no additional script, simply put it was one of my favorites, the “Regular Expression” that did the job.
Regular Expression allows you to find and change text that matches a set of conditions you specify. So with that in mind using;
“^A”
will match at the beginning of the document (as opposed to ^, which matches at the beginning of the document and also at the beginning of each line).
Our favorite Text-Editor on MacOS X is still BBEdit. BBEdit features a very powerful Grep Search & Replace panel. With it, using the above Regular Expression and adding the GPL information to 6000 documents was a very easy task.
If you enjoyed this post, make sure you subscribe to my RSS feed!










0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.