Sample Header Ad - 728x90

Simple filter to unhardwrap multiple paragraphs

0 votes
2 answers
32 views
I have many markdown files which are hardwrapped to 80 characters. I would like to copy these to paste into textareas (xclip -sel clipboard < file), but want them to wordwrap normally. This is simple w/o paragraphs - tr "\n" " " < file | xclip -sel clipboard, but turns all text into a run-on paragraph which still requires manual copy-editing. Is there a short and simple filter using standard *NIX tools (GNU versions are fine) to delete all "\n" _except_ when there are two next to each other? Ideally something I can remember and retype - less than 30 characters with no files. It feels like something sed should be able to do.
Asked by Iiridayn (369 rep)
Feb 13, 2023, 07:52 PM
Last activity: Feb 14, 2023, 12:28 PM