473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

build an array based on data from file matching criteria

I am trying to get data from a tab delimited file(example of a few
lines below). I want to count the number of authentications per hour.
The first and fourth line is an example of a line I would want to
count, the middle two are examples of other lines in the file that I
want to ignore. The approach I am looking at is reading the first
section and using the hour field as the address in the array.

int count = 0;
If (string contains "Successfully")
AuthCount[HourValue] = count ++

So the data below would result in
AuthCount[14]=1
AuthCount[15]=1

Any suggestions on how to write this?

2006-07-20 14:31:52 User.Info ServerIP Perfigo: Authentication:[User
MAC ## User IP] username - Successfully logged in, Provider:
authservername, L2 MAC address: User MAC

2006-07-20 14:31:52 User.Info ServerIP Perfigo: Administration:User MAC
added to certified device list

2006-07-20 15:12:49 User.Info ServerIP Perfigo: Miscellaneous:Overwrote
1 logs in the past 10 minutes to keep the event log limit.

2006-07-20 15:31:52 User.Info ServerIP Perfigo: Authentication:[User
MAC ## User IP] username - Successfully logged in, Provider:
authservername, L2 MAC address: User MAC

Jul 21 '06 #1
1 1281
sh*********@gmail.com wrote:
I am trying to get data from a tab delimited file(example of a few
lines below). I want to count the number of authentications per hour.
The first and fourth line is an example of a line I would want to
count, the middle two are examples of other lines in the file that I
want to ignore. The approach I am looking at is reading the first
section and using the hour field as the address in the array.

int count = 0;
If (string contains "Successfully")
AuthCount[HourValue] = count ++

So the data below would result in
AuthCount[14]=1
AuthCount[15]=1

Any suggestions on how to write this?

2006-07-20 14:31:52 User.Info ServerIP Perfigo: Authentication:[User
MAC ## User IP] username - Successfully logged in, Provider:
authservername, L2 MAC address: User MAC

2006-07-20 14:31:52 User.Info ServerIP Perfigo: Administration:User MAC
added to certified device list

2006-07-20 15:12:49 User.Info ServerIP Perfigo: Miscellaneous:Overwrote
1 logs in the past 10 minutes to keep the event log limit.

2006-07-20 15:31:52 User.Info ServerIP Perfigo: Authentication:[User
MAC ## User IP] username - Successfully logged in, Provider:
authservername, L2 MAC address: User MAC
Use a std::map<unsigned int,unsigned int>.

Cheers! --M

Jul 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: deko | last post by:
I have a counter file that records page hits - each hit is a UNIX timestamp in the file. But I'm only interested in page hits in the last 365 days. The below code creates an array from the file...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
13
by: nyt | last post by:
I have a problem of number and text field. I got the database file(mdb) that contains many combo boxes used and its list values are created by "value list" For eg field Field name= 'furniture'...
29
by: yourmycaffiene | last post by:
Okay, this if my first post so go easy on me plus I've only been using C for a couple of weeks. I'm working on a program currently that requires me to read data from a .dat file into a 2d array and...
7
by: heddy | last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int Newsize); and the newsize is smaller then what the array was previously, are the resources allocated to the objects that are...
1
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
8
by: hiro | last post by:
Hi there, I'm very new to python, the problem I need to solve is whats the "best/ simplest/cleanest" way to read in multiple files (ascii), do stuff to them, and write them out(ascii). --...
8
by: Gari | last post by:
Hello, I am trying to build a filter query with some AND and OR. I have three text boxes and 5 check boxes. The checkboxes are linked via code to other textboxes for the purpose of the query. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.