Information Technology Reference
In-Depth Information
Piping Output into Default GUI Apps
As mentioned elsewhere, you can use the OPEN command at the command line
to open files in GUI applications ( Tip 325, Start GUI Apps from the Command
Line , on page 338 ) . The command OPENFILENAME.TXT will open FILENAME.TXT in TextEdit,
for example.
However, the -F command-line switch will cause OPEN to accept output piped
from a command. For example, the following will pipe a detailed directory
listing in a new document within TextEdit:
LS -LA | OPEN -F
Piping Output into a Specific App
To choose an application other than the default, specify it using the -A switch.
I have an alternative text editor called TextMate installed on my system, 22 for
example, and the following pipes the directory listing to it:
LS -LA | OPEN -F -A TEXTMATE
Piping Output into the Clipboard
Instead of specifying the OPEN command, you can pass the output of a com-
mand to the clipboard, ready for pasting into another app. Simply use the
PBCOPY command.
LS -LA | PBCOPY
Typing Directly into the Clipboard
Should you want to, you can type text directly into the clipboard by specifying
the PBCOPY command on its own and hitting RETURN . Type what you want to
enter into the clipboard (you can include carriage returns), and hit CONTROL + D
when you've finished.
Typing Directly into the “Find” Clipboard
OS X uses a separate clipboard for what appears in find and replace boxes.
So, if you want to type something directly at the command line that you'd
like to then search for within an app like TextEdit, you can use the following
command—just replace “search phrase” with what you'd like to put in the
clipboard:
ECHO SEARCH PHRASE | PBCOPY -PBOARD FIND
22. HTTP://MACROMATES.COM
 
 
 
 
 
 
 
Search WWH ::




Custom Search