Bash script to replace contents of clipboard, principally designed around copying from pdfs of books.
Requires xclip.
Get clipboard content
Remove all consecutive newlines
Remove hyphen followed by newline
Replace newlines with space
Remove leading and trailing whitespaces
Replace multiple spaces with single space
Update clipboard with clean text
Print to terminal (in case I want to use the output for something else)