Group elements read from a txt file

Viewed 26

I´m trying to figured out how to start with my code. I'm planning to do it with python. I need to group elements that are going to be read from a txt file. The txt file contains a list of Companies and Sites. The sites depends from any specific Company on different locations. The hard part is that the order of data in the txt file does not help to much.

See an example of the file.

Folder: Root\
Folder: Root\00 Company A\
Folder: Root\00 Company A\Local Sites
Site A Online
Site B Offline
Site C Online
Folder: Root\00 Company A\Remote Sites
Site D Online
Site E Offline

Folder: Root\01 Company B\
Folder: Root\01 Company B\Local Sites
Site N Offline
Folder: Root\01 Company B\Remote Sites
Site M Online
Site P Offline

This is a report that Networking team generate via an old software they use to monitoring sites. The idea is to group Sites with Offline status by Company. I'm having troubles trying to group Sites offline for each Company, since the only identifier for each Site is just the line that says "Root\XX Company X\Local Site" or "Remote Site"

Any idea on how to start? Thanks

0 Answers
Related