Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 2-Dec-11 12:01pm
Edited 2-Dec-11 12:30pm
v3
Comments
Albert Holguin at 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 at 2-Dec-11 17:31pm
   
Thanks!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I think the Regex class is your best friend: have a look at the "Remarks" section in its documentation page[^].
  Permalink  
Comments
Néstor Muñoz at 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!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 2 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100