Append to File - Alfred Extension

The Introduction

I was inspired by this idea from Gabe over at Macdrifter and decided to port the idea over to my Alfredapp. A shell extension, part of the PowerPack could surely make quick work of this… and indeed it did!

I’ve created a quick and easy way of appending text to a file. This is great for those that have a running file or one or more text files that are used to capture ideas or whatever you may see fit (as long as it’s text of course).

This also works wonderfully with TaskAgent text files!

Working a little on Gabe’s method and simplifying it with sed, text can either be appended to the beginning of a file or to the end of a file.


You can have more than one file by simply creating another extension and changing the path to the new file.

The Caveats

Now this is far from perfect and has a few caveats that I must point out.

  1. If the filename or path to file has a space, remember to escape it otherwise this will fail;
  2. The file must have some text in it to start off with. This is a limitation of BSD’s version of sed (if anybody knows a way around this please let me know so that I may update the post and extension);
  3. While not really a caveat, I should point out that this script is adding a “-” at the beginning of each line so as to work nicely with my TaskAgent lists. If you don’t wan’t that then simply remove the “-” before {query} in the above script.