Description
- Each line of the datafile is a record consisting of a key field, followed by
a colon, and a value.
- The key field may contain several keys separated by commas.
We want to transform every multikey record to equivalent single-key records by
appending a colon and the value to every key.
|
| Raw Input
| to,two,too:t u
their,there:th
that:tha
think,thing:th ng
|
|
| Desired Output
| to:t u
two:t u
too:t u
their:th
there:th
that:tha
think:th ng
thing:th ng
|
|
Script and Comments
Script1 [ 1] s/^([^,]+),([^:]+):(.*)/\1:\3\n\2:\3/
[ 2] P
[ 3] D
| |
|