LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-05-2004, 02:00 AM   #1
lugnut
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Rep: Reputation: 0
Simple Stats question


Hello,

I'm sure this is an easy one for someone.

I have a network device log file that has the number of concurrently logged on users at the end of some of the log file lines. Using AWK, grep, and sort, I'm able extract just the numeric information I want and redirect it to a text file. What I'd like to do is to determine the mean, median, and mode from the set of numbers in the text file. The data in the text file is sorted by number and consists of one number per line (and there is nothing but a number on each line). What would be an easy way to do this (I'm only looking for how to read data from a textfile and then work with it using math functions, and not how to find the mean, median, and mode from a set of numbers )

Thanks in advance

Last edited by lugnut; 09-05-2004 at 02:06 AM.
 
Old 09-05-2004, 03:04 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I'd stick with awk, in that case ...
does it well, maths and all... you can find out
the number of records with awk, you can add
things up quite easily, ...
{ count += $1}; END{ print count/NR}


Cheers,
Tink
 
Old 09-05-2004, 03:59 PM   #3
lugnut
LQ Newbie
 
Registered: Feb 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the reply Tinkster. I'll have to check out what I can do that way. I was thinking of a shell script to read in the values from the text file, but I wasn't sure how to do that.

Thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 02:03 PM
simple question rafalek Linux - Software 1 08-24-2004 09:17 AM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 09:03 PM
simple c question painkiller6.6.6 Programming 5 09-30-2002 04:29 PM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 04:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration