Hi all,
I would like to combine all lines of a file to one line by sed script.
From:
This is the first line.
This is the second line.
This is the third line.
To:
This is the first line. This is the second line. This is the third line.
So I wrote a sed script like this:
/^$/d
1,${
G
s/^\(.*\)\n\(.*\)/\2 \1/
s/ *\(.*\)/\1/
x
}
It nearly meets my requirement because it prints once in every combination of two lines. But, if I have a big file. Only the last output is my want. How can I solve this problem or it has another simply method to do this?
Thanks!!
tikual
I would like to combine all lines of a file to one line by sed script.
From:
This is the first line.
This is the second line.
This is the third line.
To:
This is the first line. This is the second line. This is the third line.
So I wrote a sed script like this:
/^$/d
1,${
G
s/^\(.*\)\n\(.*\)/\2 \1/
s/ *\(.*\)/\1/
x
}
It nearly meets my requirement because it prints once in every combination of two lines. But, if I have a big file. Only the last output is my want. How can I solve this problem or it has another simply method to do this?
Thanks!!
tikual