D
D
drozdovae19952022-04-17 12:37:13
linux
drozdovae1995, 2022-04-17 12:37:13

How to remove line break when copying to clipboard (echo, cut, xclip)?

There was a need to copy the output from the command to the clipboard. Created the following command:

echo -n "foobar" | sha256sum | cut -c1-64 | xclip -filter -selection clipboard

Everything is copied, but when pasted into a text editor, for example, the cursor moves to the next line. If the -n key helps from line breaks at the beginning, then I don’t know how to make sure that there is no line break after - I couldn’t find it (maybe I wasn’t looking for it, of course).
I'm new to the Linux world, so don't swear)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mlyamasov, 2022-04-17
@drozdovae1995

man xclip
Option -r, -rmlastnl?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question