I want to highlight a paragraph and then do xsel
.
Often times, the xsel outputs multiple lines
$ xsel
The TCP/IP protocol suite is so named for two of its most important protocols:
Transmission Control Protocol (TCP) and Internet Protocol (IP). A less used
name for it is the Internet Protocol Suite, which is the phrase used in official
Internet standards documents. In this book, we use the more common, shorter
term, TCP/IP, to refer to the entire protocol suite.
\ No newline at end of selection
I would like to turn this into a single line:
$ xsel
The TCP/IP protocol suite is so named for two of its most important protocols: Transmission Control Protocol (TCP) and Internet Protocol (IP). A less used name for it is the Internet Protocol Suite, which is the phrase used in official Internet standards documents. In this book, we use the more common, shorter term, TCP/IP, to refer to the entire protocol suite.
\ No newline at end of selection
sometimes, the xsel
output is already single line. In this instance, whatever command I put in to convert multiple lines into a single line should ignore this rare moment.
You just have to redirect the output of xsel
to some utility like tr
for translating each newline character into a blank.
xsel | tr '\n' ' '