R
richardkreidl
Basically, I have a large input file which is delimited by the pipe '|'
symbol . Records in the file can have the same data in field 1 and
field 3.
Example the first six records are the same except for field 2.
What I need is to match on field 1 for a possible of 4 matches and no
more than that.
Then take the names from field 2 and create a new record like the first
one in my Output file below.
If the match on field 1 is less than 4 records like the second set of
records are which there are only two, look at the output file below to
see how it would be displayed. I want to show the delimiters even if
there is no data to show.
I hope I explained everything correctly. I think a hash would be the
best way to approach this problem. I'm not good on using hashes.
My sample Input file: Input.txt
agencyKillCFSLegacySync | TOM JONES | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | RICH STEVENS | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | SUE LONG | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | TIM MAYS | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | BOB SMITH | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | STEVE WILLS | This job kills the Legacy
Transformer.
ebsssecrDirTxnSubTESTStop | ALEXIS KING | To Stop TEST Directory
Transaction Subscriber.
ebsssecrDirTxnSubTESTStop | MIKE JONES | To Stop TEST Directory
Transaction Subscriber.
ebsssecrAvotusSyncNT | DON RAINS | SunONE Synchronization Process-NT
ReorgAldaudbRunStatsAldarFmcdb | SCOTT FRANKS | Updates Run Statistics
for server.
ReorgAldaudbRunStatsAldarFmcdb | CRAIG GRAVES | Updates Run Statistics
for server.
ReorgAldaudbRunStatsAldarFmcdb | DB2UDB | Updates Run Statistics for
server.
My desired Output file: Output.txt
agencyKillCFSLegacySync | TOM JONES | RICH STEVENS| SUE LONG | TIM MAYS
| This job kills the Legacy Transformer.
ebsssecrDirTxnSubTESTStop | ALEXIS KING | MIKE JONES ||| To Stop TEST
Directory Transaction Subscriber.
ebsssecrAvotusSyncNT | DON RAINS |||| SunONE Synchronization
Process-NT.
ReorgAldaudbRunStatsAldarFmcdb | SCOTT FRANKS | CRAIG GRAVES | DB2UDB
|| Updates Statistics for server.
Thanks
symbol . Records in the file can have the same data in field 1 and
field 3.
Example the first six records are the same except for field 2.
What I need is to match on field 1 for a possible of 4 matches and no
more than that.
Then take the names from field 2 and create a new record like the first
one in my Output file below.
If the match on field 1 is less than 4 records like the second set of
records are which there are only two, look at the output file below to
see how it would be displayed. I want to show the delimiters even if
there is no data to show.
I hope I explained everything correctly. I think a hash would be the
best way to approach this problem. I'm not good on using hashes.
My sample Input file: Input.txt
agencyKillCFSLegacySync | TOM JONES | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | RICH STEVENS | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | SUE LONG | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | TIM MAYS | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | BOB SMITH | This job kills the Legacy
Transformer.
agencyKillCFSLegacySync | STEVE WILLS | This job kills the Legacy
Transformer.
ebsssecrDirTxnSubTESTStop | ALEXIS KING | To Stop TEST Directory
Transaction Subscriber.
ebsssecrDirTxnSubTESTStop | MIKE JONES | To Stop TEST Directory
Transaction Subscriber.
ebsssecrAvotusSyncNT | DON RAINS | SunONE Synchronization Process-NT
ReorgAldaudbRunStatsAldarFmcdb | SCOTT FRANKS | Updates Run Statistics
for server.
ReorgAldaudbRunStatsAldarFmcdb | CRAIG GRAVES | Updates Run Statistics
for server.
ReorgAldaudbRunStatsAldarFmcdb | DB2UDB | Updates Run Statistics for
server.
My desired Output file: Output.txt
agencyKillCFSLegacySync | TOM JONES | RICH STEVENS| SUE LONG | TIM MAYS
| This job kills the Legacy Transformer.
ebsssecrDirTxnSubTESTStop | ALEXIS KING | MIKE JONES ||| To Stop TEST
Directory Transaction Subscriber.
ebsssecrAvotusSyncNT | DON RAINS |||| SunONE Synchronization
Process-NT.
ReorgAldaudbRunStatsAldarFmcdb | SCOTT FRANKS | CRAIG GRAVES | DB2UDB
|| Updates Statistics for server.
Thanks