Sponsored Content
Top Forums Shell Programming and Scripting counting word xx referred to a time period, like minute or hour Post 302508003 by maluca68 on Friday 25th of March 2011 11:20:07 AM
Old 03-25-2011
Update parameters for counting word referred to a time period

The script is launched with log-file and 2 parameters, like:
Code:
script  ‘Log_Server.csv’ ‘time-period’ ‘key-search’
   where:
* 

time-period : could be minutes (m) or hour (h)

*key-search: could be 108114 or 108083


Sometimes it works and sometime it answer an error.


Code:
gbosmam037:test  >./script.sh Log_Server.csv h  108114
 mch-stat-sm
  Parsing input file.  Please wait...
 
 Log start at 2011-02-20  00:00
 Log stop at   :
   RESULTS FOR CLIENT_ID  =  108114
  Time # MT Numbers #  Speed MT/sec
 ./mch-stat-sm.LMM.sh:  test: argument expected
gbosmam037:test  >


 gbosmam037:test  >./script.sh Log_Server.csv h        
 mch-stat-sm
  Parsing input file.  Please wait...
 
 Log start at 2011-02-20  00:00
 Log stop at 2011-02-20  23:59
   RESULTS FOR ALL  CLIENT_IDs 
  Time # MT Numbers #  Speed MT/sec
 00 # 62381 #  17
 01 # 231 #  0
 02 # 195 #  0
 03 # 73 #  0
 04 # 242 #  0
 05 # 314 #  0
 06 # 362 #  0
 07 # 474 #  0
 08 # 2630 #  0
 09 # 5202 #  1
 10 # 8837 #  2
 11 # 3619 #  1
 12 # 2401 #  0
 13 # 1273 #  0
 14 # 1343 #  0
 15 # 2925 #  0
 16 # 7299 #  2
 17 # 1745 #  0
 18 # 2815 #  0
 19 # 4381 #  1
 20 # 1834 #  0
 21 # 9564 #  2
 22 # 6042 #  1
 23 # 6335 #  1
 gbosmam037:test  >
 

gbosmam037:test  >./script.sh Log_Server.csv h  108083
   mch-stat-sm 

 Parsing input file.  Please  wait...
 
 Log start at 2011-02-20  00:00
 Log stop at 2011-02-20  22:59
    RESULTS FOR CLIENT_ID  =  108083 

 Time # MT Numbers #  Speed MT/sec
 00 # 30997 #  8
 01 # 12 #  0
 02 # 2 #  0
 03 # 0 #  0
 04 # 101 #  0
 05 # 33 #  0
 06 # 98 #  0
 07 # 73 #  0
 08 # 3 #  0
 09 # 4 #  0
 10 # 6 #  0
 11 # 5 #  0
 12 # 3 #  0
 13 # 9 #  0
 14 # 2 #  0
 15 # 2 #  0
 16 # 2 #  0
 17 # 84 #  0
 18 # 384 #  0
 19 # 401 #  0
 20 # 317 #  0
 21 # 1217 #  0
 22 # 2 #  0
 gbosmam037:test  >



Attached you can see my script.
I will appreciate if you can help me.


Luca
Moderator's Comments:
Mod Comment
Please use code tags when posting data and code samples!




 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

record wc -l over 24 hour period

I need to keep track of this output echo "dis chs(*)" | runmqsc | grep RUNNING | wc -l I need to record that count once an hour 24 hours a day and write to a file with the date and time it was run. Any idea on how to do this. (5 Replies)
Discussion started by: csaunders
5 Replies

2. Shell Programming and Scripting

Time difference in Minute in UNIX

is there any ways to get the time difference between 2 dates in UNIX? for example, For below date the outut should come 22 minutes startdate enddate ========= ======= 06/17/2008 13:25 06/17/2008 13:47 For, below date, the output should come 1462 minutes ... (5 Replies)
Discussion started by: Amit.Sagpariya
5 Replies

3. Shell Programming and Scripting

Counting average data per hour

Hi i have log like this : Actually i will process the data become Anybody can help me ? (6 Replies)
Discussion started by: justbow
6 Replies

4. Shell Programming and Scripting

Crontab for every minute or every hour

How to set crontab for every minute or every hour (1 Reply)
Discussion started by: kaushik02018
1 Replies

5. Shell Programming and Scripting

Trim the sentence containing colon and period to extract a word in between

Hello All , i am a newbie in korn shell scripting trying to trim a sentence that is parsed into a variable . The format of the sentence has three words that are separated from other by a " : " colon and "." period . Format of the sentence looks like ... (5 Replies)
Discussion started by: venu
5 Replies

6. UNIX for Dummies Questions & Answers

How to add an hour or a minute to a time?

Hi, The timestamp is June 06 2011 11:05AM i need 2 results. first, an hour added to it, June 06 2011 12:05AM second, a minute added to it, June 06 2011 11:06AM How can i do this? Also when it reaches 12:59, it needs to start from 1 again without giving the output as 13:00. it... (17 Replies)
Discussion started by: irudayaraj
17 Replies

7. Shell Programming and Scripting

return counting per hour percentage

We have a monitoring process for a load in unix box, during this process we are writing logs statements for each record, and during this process we are showing the counts per hour. Here is that how we are following log files statements: (just two lines printed here), these statements logged at... (1 Reply)
Discussion started by: skkuchipudi
1 Replies

8. Shell Programming and Scripting

How to convert 24 hour time to 12 hour timing?

Hi friends, I want to convert 24 hour timing to 12 hour please help me... my data file looks like this.. 13-Nov-2011 13:27:36 15.32044 72.68502 13-Nov-2011 12:08:31 15.31291 72.69807 16-Nov-2011 01:16:54 15.30844 72.74028 15-Nov-2011 20:09:25 15.35096 ... (13 Replies)
Discussion started by: nex_asp
13 Replies

9. Shell Programming and Scripting

[solved] Awk/shell question to parse hour minute from text

Hi, I have a quick question on parsing the hour/minute and value from a text file and remove the seconds portion. For example in the below text file: 20:26:01 95.83 20:27:01 96.06 20:28:01 95.99 20:29:01 7.11 20:30:01 5.16 20:31:01 8.27 20:32:02 9.79 20:33:01 11.27 20:34:01 7.83... (2 Replies)
Discussion started by: satishrao
2 Replies
All times are GMT -4. The time now is 12:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy