I found an unexpected behavior about the BSD sed command.
Try the following command on your FreeBSD host and you will probably see the following response.
However the GNU sed command, which is available by textproc/gsed (ports) or
on a Linux host, returns a different response. That is as follows,
I don't know why the two versions of sed commands return different responses. I suspect that the GNU sed works correctly. Because the sed "3,4N" orders to concatenate with the next line, only from the line #3 to the line #4, but NOT TO line #5.
The BSD sed has something wrong? Or that is just my misunderstanding?
Try the following command on your FreeBSD host and you will probably see the following response.
Code:
$ seq 1 10 | awk '{print $1 ",A"}' | sed '3,4N; s/\n/-/g'"]
1,A
2,A
3,A-4,A
5,A-6,A
7,A-8,A
9,A
10,A
$
However the GNU sed command, which is available by textproc/gsed (ports) or
on a Linux host, returns a different response. That is as follows,
Code:
$ seq 1 10 | awk '{print $1 ",A"}' | gsed '3,4N; s/\n/-/g'"]
1,A
2,A
3,A-4,A
5,A
6,A
7,A
8,A
9,A
10,A
$
I don't know why the two versions of sed commands return different responses. I suspect that the GNU sed works correctly. Because the sed "3,4N" orders to concatenate with the next line, only from the line #3 to the line #4, but NOT TO line #5.
The BSD sed has something wrong? Or that is just my misunderstanding?