LinuxQuestions.org
Help answer threads with 0 replies.
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, 03: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 03:06 AM.
 
Old 09-05-2004, 04:04 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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, 04: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:03 PM
simple question rafalek Linux - Software 1 08-24-2004 10:17 AM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 10:03 PM
simple c question painkiller6.6.6 Programming 5 09-30-2002 05:29 PM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 05:08 AM

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

All times are GMT -5. The time now is 12:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration