Re: change paragraphs to long lines

Daniel Goldman <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Let's hope this one makes it to the list. Last time, I forgot the default is to email the 
person (private email), not the list.

prem wrote:
 > Would not something like this do the same in a simpler way?
 > You may have to use something other than "~" if you think it might
 > already exist in the input.
 >
 > tr "\n" "~" input | sed -e '/s/~~/\n/g' -e '/~/ /g' > output

I modified your syntax some, there were some syntax mistakes (look below), but I agree it 
is a simpler way.

$ cat input
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

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

$ tr "\n" "~" < input | sed -e 's/~~/\n\n/g' -e 's/~/ /g'
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

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

Daniel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.