Open data from a pipeline in any application

Here’s a feature I wasn’t aware of, thanks to MacOSXHints.com. The open command (man page) provides a -f option, which open‘s own help says “Reads input from standard input and opens with TextEdit”. But, in fact, you can load the data into nearly any application. Simply combine the -f flag with the -a flag:

  • curl 'http://example.com/example.html' | open -a 'TextMate' -f
  • curl 'http://example.com/example.png' | open -a 'Preview' -f

I usually don’t bother using the open command with TextMate; I simply use the command line tool, which can read from standard input:

  • ps -ax |mate

BBEdit can do the same.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: This post is over 3 years old. You may want to check later in this blog to see if there is new information relevant to your comment.