I read the present topics on AskUbuntu, but none of them did fit exactly.
Situation is:
I want to replace the currently selected text (by calling a bash script via EasyStroke) with a modified version of this text. The text is modified by RegEx'es or so... it's part of the script, so it doesn't really matter.
Current state:
I can read the selection from the ClipBoard with xclip, modify it and copy it back to the ClipBoard with the following command (part of the called bash script):
xclip -o | sed 's/ab/ef/g' | xclip -sel clip
The test string is
cdabcdabcdabcdab
And after applying the above command, the output (in the ClipBoard) is
cdefcdefcdefcdef
which is correct. But the result is still stored in the ClipBoard and not pasted back to the application. I have to paste it to the currently running application with Ctrl+V manually.
Question is:
How can I automate the last step of pressing Ctrl+V to immediately paste the result to the application in which the source text has been selected?
I tried xclip
and xsel
, but I was unable to make them work the way described above.
Any suggestions?
Thanks to @meuh's comment above, I was able to complete this task:
Install these programs:
Create a
.bash
script for the transformation:Call this script from easystroke or a similar program that processes key- or mouse-strokes.