Replace CR/LF in a text file only after a certain column

Posted by Olav on Stack Overflow See other posts from Stack Overflow or by Olav
Published on 2010-05-16T12:31:43Z Indexed on 2010/05/16 12:40 UTC
Read the original article Hit count: 280

Filed under:
|
|

I have a large text file I would like to put on my ebook-reader, but the formatting becomes all wrong because all lines are hard wrapped at or before column 80 with CR/LF, and paragraphs/headers are not marked differently, only a single CR/LF there too.

What I would like is to replace all CR/LF's after column 75 with a space. That would make most paragraphs continuous. (Not a perfect solution, but a lot better to read.)

Is it possible to do this with a regex? Preferably a (linux) perl or sed oneliner, alternatively a Notepad++ regex.

© Stack Overflow or respective owner

Related posts about regex

Related posts about sed