-2

I actually can't really provide much info than the subject:

I need to copy text from a document, and each time I have to adjust it very fine to not copy any whitespace characters at the end.

I wish to either:

  • Copy the text without whitespace endings
  • or paste the text without whitespace endings

Only hotkeys are interesting, I need to do this many times.

Example:

text with ending space  

Steps to reproduce my problem:

  1. Select the line with triple-click
  2. Hit CTRL-C to copy
  3. Hit CTRL-V to paste

Problem:

During selection the trailing spaces are also selected:

enter image description here

Goal

text with ending space

Selected:

enter image description here

Daniel
  • 117
  • Please read [ask] then [edit] your question with further more specific detail. Your two questions on AU so far have not been well structured so as to be clear and concise. – graham Aug 12 '22 at 13:31
  • Don't speculate more, I updated with my requirements. – Daniel Aug 12 '22 at 13:42
  • Are you open to text-based (non-graphical) solutions like awk or sed that use search terms to select instead of your finger on a mouse/trackpad? – user535733 Aug 12 '22 at 13:43
  • Source is in GoogleDocs unfortunately. – Daniel Aug 12 '22 at 13:56

1 Answers1

0

What you describe is expected behavior. If you select and copy a line, it will be selected, including the trailing space if any.

Linux has command line tools to interact with the clipboard, xclip or xsel for Xorg or wl-clipboard if you are running Wayland. Key presses can be simulated using xdotool (Xorg) or ydotool (Wayland).

Thus, you could create a little script that

  1. Retrieves the text from the clipboard
  2. Removes any trailing white space
  3. Places the modified text back on the clipboard
  4. Paste the modified text by simulating hitting Ctrl+V

Assign your script to a custom shortcut key.

vanadium
  • 88,010