473,487 Members | 2,461 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Jagged array comparisons

1 New Member
Ive got another querie though. Im not sure how to say - if several elements are all the same, and theres another line that has the exact same except one specific feild, deleate that line.

In other words take a look at my data:

access-list 1 permit tcp 192.168.1.2 0.0.0.0 168.111.2.1 255.255.255.0 = 23
access-list 2 deny udp 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 = 23
access-list 3 permit ospf 192.168.2.3 255.255.255.0 0.0.0.0 255.255.255.255 = 179
acess-list 2 deny ospf 192.168.2.3 255.255.255.0 0.0.0.0 255.255.255.255 = 179
access-lst 3 permit 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 = 21
access-list 5 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 14 deny 191.168.0.1 255.255.0.0 0.0.0.0 255.255.255.255 = any
access-list 443 permit 192.163.0.1 255.255.0.0 0.0.0.0 255.255.255.255 = any
access-list 77 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 5 deny 192.168.34.4 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 5 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 2 permit 192.168.1.13 255.0.0.0 0.0.0.0 255.255.255.255 = any
access-list 77 deny 192.168.0.1 255.255.0.0 0.0.0.0 255.255.255.255 = any
access-list 88 permit 192.168.0.1 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 1 deny 192.168.0.2 255.255.255.0 0.0.0.0 255.255.255.255 = any
access-list 2 permit 192.168.0.4 255.255.255.0 0.0.0.0 255.255.255.255 = any

Taking into consideration that [2] can be only permit or deny:

Im trying to say if all the elements of each line were the exact same, apart from [2] The permit or deny element, then delete the lines that have opposing [2] rules. In other words if I had:

access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 deny 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.163.1.1 0.0.0.1 ...ect
access-list 1 deny 192.168.1.1 0.0.0.1 ...ect
access-list 1 deny 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 111.162.1.1 0.0.0.1 ...ect
access-list 1 permit 195.168.4.1 0.0.0.1 ...ect

Then by looking at the first rule and saying:

For any line where:

access-list 1 192.168.1.1 0.0.0.1

was the same and only the permit feild is changed delete it and display the new file. Which would probebly look like this.

access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.168.1.1 0.0.0.1 ...ect
access-list 1 permit 192.163.1.1 0.0.0.1 ...ect
access-list 1 permit 111.162.1.1 0.0.0.1 ...ect
access-list 1 permit 195.168.4.1 0.0.0.1 ...ect

in other words if the rules is

access-list 1 permit 192.168.1.1 0.0.0.1

deleat all other rulles that look like this:

access-list 1 deny 192.168.1.1 0.0.0.1


I have a rule that deals with exact copys and would like to keep them differant so now im just trying to delete conflicting permit/deny feilds.

I know this is pretty complicated so any help as to how it would be done would be excellent.

Thanks in advance.
Mar 11 '08 #1
1 2752
Plater
7,872 Recognized Expert Expert
You want BOTH the rules to be wiped out, or just one? What if there were three rules (two of them were permit and one was deny say), would you keep one or do all three get deleted?
(I understand as conflicting rules they are invalid)

What if you took like a datatable with 3 columns.
One column would be the key and would be the concatination of all the fields other then the permit field. The second column would BE the permit field and the third would be a count.
You would keep adding into the table any new key values (and the permit field and a count of 1), if it already exists, just increment the count.
Any records with a count over 1 would be deleted and then you can pull back your data?

That seems like a lot of work now that I think about it, but it's the best I've come up with so far.
Mar 11 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2455
by: ritchie | last post by:
Hi all! Still working on this program! Just to recap, I am writing a program to sort an array with four different sort algorythms. I am having a little trouble at the moment though! Now, I...
1
2697
by: James dean | last post by:
I done a test and i really do not know the reason why a jagged array who has the same number of elements as a multidimensional array is faster here is my test. I assign a value and do a small...
3
2175
by: Ravi Singh (UCSD) | last post by:
Hello all I am trying to use jagged and multi-dimensional arrays in C++. In C# these work fine // for jagged arrays string jaggedArray = new string ; //for multidimensional arrays string...
1
10253
by: xllx.relient.xllx | last post by:
Hi, I have two questions: 1.)Is it true that an rectangular array is really just an single dimensional array that lets itself be treated as a multi-dimensional array? For example the...
4
2361
by: Alan Foxmore | last post by:
Hi everyone, I'm new to C# and I was hoping I could get some clarification on the syntax for jagged and multidimensional arrays. Here is my question: The following syntax is correct for...
2
6174
by: deko | last post by:
I trying to create a jagged array of two arrays, with the second array being an array of two-dimensional arrays. A graphical representation might look like this: x y y y x y x y y x ...
2
3950
by: tiberiu.motoc | last post by:
Hi. I've asked this question on the MSDN forums, but I've had no replies. I'm really stuck, so I'm gonna try my luck here. I have a Java web service which contains a simple function; the...
5
10322
by: TS | last post by:
is there some code somewhere that does this? i have a jagged array that is not jagged, it has an equal number of rows and columns in each array so it should convert but want to get the code to do...
17
7210
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
3
6083
by: pinkfloydfan | last post by:
Hi there I have a C# program that produces a lot of data that I currently store in a jagged array and I have a couple of questions that I was hoping someone might shed some light on for me...
0
7108
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4875
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1383
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.