Hello,
When I paste the contents of the clipboard to the command line via pbpaste, there is also a carriage return implicitly pasted (i.e. whatever gets pasted is automatically sent as a command). Is there a way to use pbpaste without this feature, so I can edit the text before sending the command?
$ ll
total 0
drwxr-xr-x 2 scott staff 68 Jan 15 21:20 .
drwxr-xr-x+ 58 scott staff 1972 Jan 15 21:20 ..
$ touch x
$ ll
total 0
drwxr-xr-x 3 scott staff 102 Jan 15 21:20 .
drwxr-xr-x+ 58 scott staff 1972 Jan 15 21:20 ..
-rw-r--r-- 1 scott staff 0 Jan 15 21:20 x
$ # I put "rm x" in the clipboard at this point
$
$ pbpaste
rm x$ ll
total 0
drwxr-xr-x 3 scott staff 102 Jan 15 21:20 .
drwxr-xr-x+ 58 scott staff 1972 Jan 15 21:20 ..
-rw-r--r-- 1 scott staff 0 Jan 15 21:20 x
You're right. Once it is pasted, a new prompt appears immediately to the right of the paste, and the pasted text cannot be edited to launch as a command. Do you know if there is a way to do this?
cat file
1 aaa
2 bbb
3 ccc
4 ddd
In TextEdit, I then copy the characters “ccc” to the clipboard. The problem is that the following command gives no output:
bash-3.2$ pbpaste | grep - file
Desired output:
3 ccc
What should the syntax be for that command? I am using MacOS El... (3 Replies)
Hello,
Here is what I am trying to do:
1) Copy a string to the pasteboard using Command-C
2) Search for the string in a file in X11.
Command-C
pbaste | grep - filname (does NOT work)
What is the correct syntax?
Thanks! (4 Replies)