Re: change paragraphs to long lines
George Georgalis <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <CAHK3FNwokqNK7un19uWHR9V=JtrM1758jOF50EeEq6MJquwJnw@mail.gmail.com> |
Thanks Thierry, Davide and private email!
I used all your input. From the private email, a longer way of Davide's
method, which helped me see the algorithm and get to the understanding the
others failed due to DOS format. After fixing the line endings, I ended up
going with Thierry's method since it seemed to handle leading blank lines
better: sed -r '/^$/!{:a;N;/\n$/b;s|\n| |;ba}'
Big help, I think I will add this as a macro in my editor. And I vote to
add it to the sed1line file!
Regards,
-George
On Mon, Nov 4, 2013 at 10:36 PM, 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?
>
> Regards,
> -George
>
>
> --
> George Georgalis, (415) 894-2710, http://www.galis.org/
>
--
George Georgalis, (415) 894-2710, http://www.galis.org/