Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good afternoon,

I am working with Visual-Studio 2010 and I need to read one text file line by line and compare each line to some set of rules (some of these depend of others).

The idea is: I am taking the configuration from almost 500 Cisco equipments (Routers, Switches, IPS, Firewalls) and compare the configurations with a set of rules depending on the Hardware and the purpose for each command.

How can I create a set of rules with variables such as "If Begin with" or "If end with" or "If contains" and so on but that I can add new rules WITHOUT modifying the source code (I don't know if I am clear) but having like a ListBox where I can add/delete/modify the rules, and one big script that can understand these rules?

Any help will be appreciated!


------- Modify:

If you know of a script previously created that allows to "Create" a "Language" to compare text strings according a modifyble set of rules, it will be awesome!
Posted
Updated 2-Dec-11 11:30am
v3
Comments
Albert Holguin 2-Dec-11 17:21pm    
Tag with appropriate programming language... that will get you the appropriate audience (of experts) for your question.
Néstor Muñoz 2-Dec-11 17:31pm    
Thanks!

I think the Regex class is your best friend: have a look at the "Remarks" section in its documentation page[^].
 
Share this answer
 
Comments
Néstor Muñoz 2-Dec-11 17:48pm    
But, how do I create some sort of "Rule list" that I can Create/Delete/Modify/re-order?

I've been trying with ListView, but it doesn't seem to be the best way.

Oh, and Thanks!
Perhaps a quick example will help you to understand me:

I got this text:

Cisco Adaptive Security Appliance Software Version 8.0(5)
Device Manager Version 6.3(1)

Compiled on Mon 02-Nov-09 21:22 by builders
System image file is "disk0:/asa805-k8.bin"


And line by line I will need:

1st line: "If the first characters are "Cisco Adaptative Security Appl..." take the part after "Version" and print.
2nd line: The same with the 6.3(1)
Ignore 3rd and 4th
5th Line: take System Image Filename (between ") without the ".

And in some lines I will need to validate three or four things at the same time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900