Escape code sequence for copying file content

I found from here that you can use ANSCI Escape sequence to copy from a remote ssh session like so,

printf "\033]52;c;$(printf "%s" "blabla" | base64)\a"

I have tried issuing command,

$ (file=README.md; printf "\033]52;c;$(base64 $file)\a")

But I am able to print only the first few characters (~57 characters). Is there a way to copy the whole content of a file with the Escape sequence?


Solution 1:

If you want the output printed to the clipboard you may use xclip

xclip -sel -p -i < <( \
 printf %s%s%s '\033]52;c;' "$(printf %s blabla | base64)" '\a' \
)