Programmatically eliminating lines

February 16, 2011 at 20:58:08
Specs: Windows 7
File 1 contains Machines names followed by the Apps on that machine in format shown below. File 2 contains just App names as shown below. The idea is to add Apps to File 2 one at a time. Every time i add an App to File 2 i want to scan File 1 and delete all entries corresponding to that App.

File 1

MachineA
App1
App2
App3
App4
MachineB
App3
App4
App7


File 2

App1
App2
App3


So for eg. after the first run, File 1 would now like:

File 1

MachineA
App4
MachineB
App4
App7

Note App1, App2, App3 are no longer in File 1.

Now as I continue to add Apps to File 2, at some point some machines in File 1 will no longer have any apps assigned. I want to pull those machines out after each run and save them to a new file along with the all the apps I have added to that point.

So for eg. after the first run above, the new file would contain the following:

App1,App2,App3
(there would be no machines since both Machine 1 and Machine 2 still have an app assigned)

Now in the following run, if i add App4 to File2 (in addition to App1, App2 and App3), the corresponding File 1 would look like this:


File 1

MachineA
MachineB
App7

And the "new" file would look like this

App1, App2, App3,App4
MachineA

Since Machine A no longer has any apps assigned to it.

Also, I want to append to the "new" file after each run (not create a new file). So the new file after the second run would look like

New File

App1,App2,App3
App1,App2,App3,App4
Machine1


Ofcourse, i want to do this programmatically.


See More: Programmatically eliminating lines

Report •


#1
February 17, 2011 at 07:48:26
I think i can probably eliminate the lines using yank.exe (clay's utility), but i'm not sure how i would go about parsing File 1 after each run to determine which machines no longer have an App assigned. Any ideas?

Report •
Related Solutions


Ask Question