You can use the clipboard from the directly from the terminal application, Mac OS X gives you two commands:
pbcopy
pbpaste
Naturally pbcopy will copy something on the clipboard and pbpaste will paste something from the clipboard.
For example you might want to save the results of a search on the file system:
# find ./ -name "*.doc" | pbcopy
this command will find for all the .doc documents starting from the current directory and then it will put the result in the clipboard.
if you want to make a text file from the content of the clipboard you can issue the following command:
# pbpaste > pasted.txt
This command will create the file pasted.txt with the content of the clipboard.
For further information issue the following commands:
# man pbcopy
or
# man pbpaste
Gg1
excellent thanks for this
Good, but I prefer
find ./ -name "*.doc" > testfile.txt