Wednesday, September 30, 2015

BBEdit and "Text Factories"

I recently used a very powerful feature of BBEdit, the venerable text editor from Bare Bones Software for the very first time, and wanted to share this because it is so cool.

I had several hundred CSS files and I needed to do a series of 6 search and replaces on each file. I also had several hundred HTML files that needed a chunk of code inserted into the <head> element of each. After spending about an hour learning about BBEdit’s Text Factories feature, I was able to set it up and process all the files in a matter of minutes.

The Text Factories feature lets you create a list of text “transformations” such as changing case, adding prefixes or suffixes to lines, complex GREP find/change, sorting, fixing quotes, and more.

Screen Shot 2015 09 30 at 3 30 14 PM

Once you’ve created your list, you can apply it to the current document or selection, or to a specific list of files and folders.

Screen Shot 2015 09 30 at 3 37 30 PM

Subfolders within a folder can filtered, so you can specify certain top-level folders, but then restrict the text factory to only specific types of subfolders or files.

Screen Shot 2015 09 30 at 3 30 27 PM

As part of this project, I also used a little program called Hazel from Noodlesoft to solve another challenge. I was given a folder that contained thousands of files and subfolders. I needed to delete all the files of certain types within the folders, move certain files to new locations, and rename certain files. Hazel let me set up rules specifying what should be done to what type of file where, and then with a single command make it so. Very handy! 




No comments: