Description
The first two scripts will retain all blank lines while the third one will
remove them.
|
| Raw Input
|
| Desired Output
|
(p1,l1)
(p1,l2)
(p2,l1)
(p2,l2)
(p2,l3)
(p2,l4)
(p3,l1)
|
|
(p1,l1)(p1,l2)
(p2,l1)(p2,l2)(p2,l3)(p2,l4)
(p3,l1)
|
|
Script and Comments
Script1 [ 1] /^$/b
[ 2] :loop
[ 3] $!{
[ 4] N
[ 5] /\n$/!b loop
[ 6] }
[ 7] s/\n(.)/\1/g
| |
Script2 [ 1] /^$/b
[ 2] :loop
[ 3] $!N
[ 4] s/\n(.)/\1/
[ 5] t loop
| |
| Raw Input
|
| Desired Output
|
(p1,l1)
(p1,l2)
(p2,l1)
(p2,l2)
(p2,l3)
(p2,l4)
(p3,l1)
|
| (p1,l1)(p1,l2)
(p2,l1)(p2,l2)(p2,l3)(p2,l4)
(p3,l1)
|
|
Script and Comments
Script1 [ 1] /^$/d
[ 2] :loop
[ 3] $!{
[ 4] N
[ 5] /\n$/!b loop
[ 6] }
[ 7] s/\n//g
| |