|
Home > Archive > Unix questions > September 2006 > How do I combine lines in a file using SED?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How do I combine lines in a file using SED?
|
|
| vrineer@gmail.com 2006-09-07, 1:27 am |
| I can spell SED, that's about it.
I want to combine lines, two at a time.
Say my input is:
line1
line2
line3
line4
I want my output to be:
line1line2
line3line4
Thanx.
| |
| Bill Marcum 2006-09-07, 1:27 am |
| On 6 Sep 2006 12:03:59 -0700, vrineer@gmail.com
<vrineer@gmail.com> wrote:
> I can spell SED, that's about it.
>
> I want to combine lines, two at a time.
>
> Say my input is:
>
> line1
> line2
> line3
> line4
>
> I want my output to be:
>
> line1line2
> line3line4
>
sed -e 'N' -e 's/\n//' file > newfile
--
Basic is a high level languish. APL is a high level anguish.
| |
| vrineer@gmail.com 2006-09-07, 1:27 am |
| Works perfectly. Thank you for your expertise.
Bill Marcum wrote:
> On 6 Sep 2006 12:03:59 -0700, vrineer@gmail.com
> <vrineer@gmail.com> wrote:
> sed -e 'N' -e 's/\n//' file > newfile
>
>
> --
> Basic is a high level languish. APL is a high level anguish.
| |
| Stephane Chazelas 2006-09-08, 1:30 am |
| On 6 Sep 2006 12:03:59 -0700, vrineer@gmail.com wrote:
> I can spell SED, that's about it.
>
> I want to combine lines, two at a time.
>
> Say my input is:
>
> line1
> line2
> line3
> line4
>
> I want my output to be:
>
> line1line2
> line3line4
[...]
paste -sd '\0\n' input > output
--
Stephane
|
|
|
|
|