473,386 Members | 1,602 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,386 software developers and data experts.

Calculate the unique metrics in a file

For e.g. i have a log file in which there are many entries for appGUID. Now how many appGUID's are there, for this i have a code, but how many of them are unique, for this i don't have code. Please can anyone help me on this.
Feb 19 '13 #1
4 1679
Rabbit
12,516 Expert Mod 8TB
This is not a code writing service but if you post the code you've tried along with a description of the problem you're having with it, we can help guide you to a solution.
Feb 19 '13 #2
I have a perl script that finds the number of unique users in a log file by calling the function 'print_unique_users'. Following is the perl script :

Expand|Select|Wrap|Line Numbers
  1. function num_unique_users() {echo `print_unique_users 0 | gawk -F"," '{counts[$1]+=1}; END { print length(counts)}'` }
Now this same logic i want to apply in C sharp language. Can you help ?
Feb 20 '13 #3
Actually i wanted to parse logs to find unique entries in a file for a particular field. My file has the log entries in following format :

User:ashishg appGUID: wx
User:weqeld appGUID: c09d24cb-bb4f-422b-963a-9cbd00d203cc
User:weqeld appGUID: c09d24cb-bb4f-422b-963a-9cbd00d203cc
User:gulanand appGUID: wx
User:gulanand appGUID: wx

Now i wanted to calculate unique appGUID/User from this log file. How can i do that using C sharp program ?
Feb 20 '13 #4
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

The general algorithm to deduplicate a series of values is this:
0) Create an array
1) Loop through each value
2) Check if the value is in the array
3) If not, add it to the array
Feb 20 '13 #5

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

Similar topics

1
by: Tim ffitch | last post by:
Hi I have an MDE database that stores all 17000000 UK Postcodes. This database also includes a custom function and data type to return map grid coordinates for a given postcode. I have set a...
29
by: Lauren Wilson | last post by:
Does anyone know how the following info is extracted from the user's computer by a Front Page form? HTTP User Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107...
8
by: gumi | last post by:
Hi, I am looking for code for a alarm clock program that pops up a messege to be used as part of my VB.Net class project. Any help is very much appreciated. Thanks
11
by: Dynamo | last post by:
Hi, I am looking for a script that will download a pdf file from my server without opening it in IE. I want peeople to be able to simply download the file and store it in a location on their PC....
2
by: Rhys.Mataira | last post by:
My code will not show up anything at all on the screen can someone guide me why this would be? <?php $pagetitle="Login"; If (!$_POST) or (!$_POST) { echo" <head></head> <style...
3
by: Ryan Liu | last post by:
Hi, I want to change keywords text color in a text editor. I select RichTextBox and use its Select() method to select keywords line by line, one by one, then change its color. ...
2
by: Laphan | last post by:
Hi All Please, please help. I'm not completely thick, but php terminology for getting and installing extensions is soooo confusing to me. All I want to do is use the following code: <?php
3
by: manigattani | last post by:
Please let me know of some java code for converting dbf file to text file
13
by: jhamb | last post by:
Hi, This code is in Perl (just a trial, not tested) to parse a text file and output to another file. It is used to delete lines that are not required and output lines that the user wants, to a new...
2
by: ahmed222too | last post by:
when i use this code to copy a text file and paste it in a specific path: Dim fso As New FileSystemObject fso.CopyFile "C:\Files\file.txt", "C:\Files1\file_copy.txt" this error appear ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...

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.