Path: utzoo!attcan!ontmoh!peter From: peter@ontmoh.UUCP (Peter Renzland) Newsgroups: comp.unix.questions Subject: Re: Stripping "hard returns" from UNIX mail files Message-ID: <657182670.22483@ontmoh.UUCP> Date: 29 Oct 90 06:44:31 GMT References: <1990Oct23.135606@casbs.Stanford.EDU> Organization: Ontario Ministry of Health -- Decision Support, Toronto, Canada Lines: 34 patrick@casbs.Stanford.EDU (Patrick Goebel) asks for a UNIX utility to remove "hard returns" from mail messages for subsequent processing by MS-DOS wordprocessors. Unix considers it natural for text to be made up of lines, and all programs that do useful things with text assume that such lines are within some reasonable limit. This corresponds to things that naturally contain lines (text in books or on your display, or on typewriter, or a line printer), and those things, naturally, have limits on the line length. The RETURN key, and its code, is an implementation of the typewriter's "carriage" return. Text which is thus made up of lines can easily be formatted in all sorts of ways. But, if we format it so that we have (limitless) multiline paragraphs and no longer any line separators, some of our programs that are so handy with lines of text may break in the face of possibly huge paragraphs. Having said that, you could try something like this little program: awk ' NF==0 { if(LINE) { print LINE ; LINE="" } ; print ; next} { if(LINE) LINE=LINE " " $0 ; else LINE=LINE $0 } END { print LINE } ' $* I would prefer to use the PC wordprocessor's text import facilities to take standard line-oriented text and convert it to its own paragraph format. -- Peter Renzland @ Ontario Ministry of Health 416/964-9141 peter@ontmoh.UUCP