Finding existing occurances in a file...
Posted on 2003-02-20
Just some problem I've encountered...
I have this text file where there are the following for multiple servers:
Server name: Longest downtime
Server a: 150
Server b: 20
Server c: 150
Server d: 75
I want to scan the file and when there are servers with the same longest downtime, I need to add a new field for that record, being average downtime, and then place this edited line back into the text file.
Like taking server a and server c out so I can process them....into like
Server a: 150 (85)
Server c: 150 (70)
The average is calculated via another subprocedure so thats not the problem, its just the identification of those lines with the same "longest downtime" value that is posing some difficulties.
So can anyone show me how to find occurances with the same downtime, extract them for editing somehow so I may append the average onto the end of the line?