Weekly statistics using while loop.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Weekly statistics using while loop.
# 1  
Old 06-27-2007
Weekly statistics using while loop.

Hi people i have a situation here: my server generates a statistics text file every 30 mins. i have a script (txt2csv.sh) to convert all the statistics for the day into one csv file. Therefore i am doing a script to auto converts the text files into csv base on a weekly basis.
the script is suppose to be run using this command :
./wklystats 06 11 #base on mm dd
then it should generate a csv for a day one at a time and increase the date numbering by one and generate another csv file until the loop is completed.


Code:
#!/bin/sh

SCRIPTNAME=`basename $0`


show_help ()
{
    echo "Usage: $SCRIPTNAME [input month, mm] [input day, dd]"
    echo "This file is used to generate weekly statistics"
    echo ""
}

if [ $# != 2 ]; then
    show_help
    exit 1
fi

dateday=${2}
inputname="statistics-2007"${1}$dateday"-*"
outputname="statistics-2007"${1}$dateday".csv"


i=1
while [ $i -le 7 ]
do

        ./txt2csv.sh $inputname $outputname
        dateday=$(( dateday + 1))
        i=$(( i+1))

done

# 2  
Old 06-27-2007
No question, no answer.
# 3  
Old 06-27-2007
hmmm.. sorry

anyway my code is not working its is not adding up the date producing the right output.
# 4  
Old 06-27-2007
For the date calculation problem, read this thead Yesterdays Date/Date Arithmetic
# 5  
Old 06-27-2007
Thanks aigles
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Text statistics

Hello every body if I want to get the following statistics from a text file 1- sorted the n frequent words 2- sorted the n frequent characters 3- sorted the n frequent diagrams (tow letter together like th OR he) 4- sorted frequent n trigrams like (the OR all etc. ) 5- any character... (10 Replies)
Discussion started by: khaled79
10 Replies

2. UNIX for Dummies Questions & Answers

Any way to get process statistics?

Hi, Can someone advise what "generic" command can I use to show statistics of a process or a running script/process? For example, I want to know how many hours/minutes it's taken to run or has been running, how much CPU it used and how much memory it used or uses. I want to be able to... (2 Replies)
Discussion started by: newbie_01
2 Replies

3. Shell Programming and Scripting

statistics using awk

Hi, I have 3 columns in a file listed below. X Y X/(X+Y) 1 1 0.5 1 1 0.5 4 1 0.8 1 1 0.5 6 1 0.857142857 1 1 0.5 23 1 0.958333333 Now I want to find confidence interval using the formula for each row. (p-2 sqrt p(1-p)/(x+y), p+2... (7 Replies)
Discussion started by: Diya123
7 Replies

4. AIX

Statistics Aix

Hello If there is a way to get a statistics from Aix box server from a month. cpu use, memory, disc use, etc. Maybe via smitty or I need to do a script. The os is Aix 5.3 Greetings (8 Replies)
Discussion started by: lo-lp-kl
8 Replies

5. HP-UX

packets statistics

Hi there, are there any functions that can get the packets statistics on UNIX ? thanks. (2 Replies)
Discussion started by: Frank2004
2 Replies

6. Solaris

how to get server statistics

Hello What commands can give following type of information about the server: Time: 20080331.12:10:39 Current CPU: 97.0% Current Memory: 3.7% Current Disk Space: 76% The resources on server is currently not available. Current CPU, Memory, or Disk Space is exceeding threshold Waiting for... (2 Replies)
Discussion started by: shalua
2 Replies

7. UNIX for Advanced & Expert Users

Getting Socket statistics

Is there any way to get the file descriptor statistics of a socket file descriptor? I know that the fstat, stat system calls are for this purpose, but I want to know it there any way to get socket connection statistics for a file descriptor(like socket flags, connection type etc). Does /proc... (3 Replies)
Discussion started by: comp_wizard07
3 Replies

8. Shell Programming and Scripting

Analyze Statistics

I have a file which contains records in the format of 2006-08-25 12:06:13|ABC|93 2006-08-25 12:45:55|ABC|203 2006-08-25 01:48:19|DEF|156 2006-08-25 01:49:09|ABC|12798 2006-08-25 02:49:59|GHL|4109 2006-08-25 03:50:50|DEF|234 where the format is "arrive time"|"message type"|"processing... (3 Replies)
Discussion started by: mpang_
3 Replies
Login or Register to Ask a Question