Description
- Each line of File1 is a key consisting of only digits.
- Each line of File2 is a record beginning with a key
followed by a blank and data.
We want to list records whose keys are not listed in File 1.
|
| Raw Input
| |
File1: list of keys.
| 4164754
5859999
6123574
5851388
3214587
|
|
| Raw Input
|
| Desired Output
| |
File2: Records.
| 9874563 The number calling is 111
5851388 The number calling is OK
6237733 the number is wrong
5859999 The number calling is ok
|
| 9874563 The number calling is 111
6237733 the number is wrong
|
|
Script and Comments
Script1 [ 1] :loop
[ 2] 1,/\n[0-9]+ [^\n]*$/{
[ 3] /\n[0-9]+ [^\n]*$/!{
[ 4] N
[ 5] b loop
[ 6] }
[ 7] h
[ 8] s/\n[^\n]*$//
[ 9] x
[10] s/^.*\n//
[11] }
[12] G
[13] /^([0-9]+) .*\n\1(\n|$)/!P
[14] d
| |
|