Description
Two lines are said to be `almost identical' if they are the same after
removing all blanks. For example, T h i s i s a test is `almost identical' to This is a test.
|
| Raw Input
|
| Desired Output
| first record
first r e c o r d
f i r s t r e c o r d
s e c o n d record
third r e c o r d
t h i r d record
final record
|
| first record
s e c o n d record
third r e c o r d
final record
|
|
Script and Comments
Script1 [ 1] G
[ 2] h
[ 3] s/ //g
[ 4] /^(.*)\n\1$/{
[ 5] x
[ 6] s/^.*\n//
[ 7] }
[ 8] /\n/{
[ 9] g
[10] 1!s/^.*\n//p
[11] g
[12] s/\n.*//
[13] }
[14] $q
[15] h
[16] d
| |