Re: change paragraphs to long lines
Davide Brini <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 4 Nov 2013 22:36:41 -0800, George Georgalis <[email protected]> wrote: > Hello sed list, hope you are all well. > > Long time subscriber but I've not been following lately, hope this hasn't > come up recently. > > I have a file with double returns to denote paragraphs. I'd like to retain > the double returns but join all the other lines, so paragraphs have long > lines. > > > so this: > one two three one two three one two three one > two three one two three one two three one two > three one two three one two three one two > > one two three one two three one two three one > two three one two three one two three one two > three one two three one two three one two > > changes to this: > one two three one two three one two three one two three one two three one > two three one two three one two three one two three one two > > one two three one two three one two three one two three one two three one > two three one two three one two three one two three one two > > Maybe this solution would good for the sed1line file? A simple way would be (gnu sed) sed ':a; $!{N;ba;}; s/\n\n/\x1/g; s/\n/ /g; s/\x1/\n\n/g' or without slurping the file: sed ':a; $b; N; /\n$/b; s/\n/ /; ba' -- D.