Open data from a pipeline in any application |
|
|
The open(1) 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/encodingerror.html' | open -a 'Hex Fiend' -f
curl 'http://example.com/example.html' | open -a 'TextMate' -f
curl 'http://example.com/example.png' | open -a 'Preview' -f
curl 'http://example.com/example.m4v' | open -a 'QuickTime Player' -f
Of course, the source of the data doesn't have to be curl; it can be any command. Note that the last two examples aren't even textual data: one is an image, and the other is a video file. You aren't limited to text; any data will work. But there is a catch: open will save the file with a .txt e...
|