Want to alter text when it is copied to clipboard

Hi,

tldr: Is there a way to do a "sed" on the clipboard content?

I'm currently facing a problem with the books app from Apple.
When I'm doing copy&paste of any text inside a book, the app always adds quotation marks and some attribution information

For example, I select and copy:

Lorem ipsum

Then I get on pasting:

"Lorem Ipsum"

Excerpt from blablabla

This is very frustrating and I would like to get rid of these additions.
Somebody wrote a blogpost about removing the citation stuff using Automator, which would do what I'm looking for. I would like to tie this functionality to one specific app (Books) and one specific Keyboard Shortcut (CMD+c)

So it would be really cool if I could do it in BTT. I found out I could run a shell script when a specific shortcut is pressed.

The information I'm missing is: how I can access the latest entry in the clipboard and pipe it to the shell?

Any help would be appreciated, thanks

Miles

Imprint | Privacy Policy