How to calculate the maximum value & min value


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to calculate the maximum value & min value
# 1  
Old 05-28-2008
How to calculate the maximum value & min value

I have a file as like below,

Code:
10:20:30.45 	START 	10.20.30.40
10:20:31.46 	HELLO 	10.20.30.40
10:20:32.46	START 	10.20.30.41
10:20:33.44	END   	10.20.30.40
10:20:35.44 	HELLO 	10.20.30.41
10:20:36.56 	HELLO 	10.20.30.41
10:20:37.78 	HELLO 	10.20.30.41
10:20:38.99 	START 	10.20.30.40
10:20:39.11 	HELLO 	10.20.30.41
10:20:40.23 	HELLO 	10.20.30.40
10:20:41.23 	END 	10.20.30.41
10:20:45.45 	HELLO 	10.20.30.40
10:20:47.66 	HELLO 	10.20.30.40
10:20:50.32 	END 	10.20.30.40

I need the output like this,
Code:
No. Of Hello for 10:20:30:40 - 1
No. Of Hello for 10:20:30:41 - 4
No. Of Hello for 10:20:30:40 - 3

Also,
Code:
END - START for IP 10:20:30:40 -(10:20:33.44-10:20:30.45)=2.99
END - START for IP 10:20:30:41 -(10:20:41.23-10:20:32.46)=8.77
END - START for IP 10:20:30:40 -(10:20:50.32-10:20:38.99)=11.33

Note: Same IP will be get repeated, but i need a seperate "count" & "Time taken" of HELLO for the same IP at different session...Please help me out to solve this

Thanks in advance

Last edited by Yogesh Sawant; 05-29-2008 at 01:59 AM.. Reason: added code tags
# 2  
Old 05-29-2008
Shell script to manipulate a message count for the same IP @ diff session

Changing the title
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP Shell Script Get & Delete && Upload & Delete

Hi All, Do you have any sample script, - auto get file from SFTP remote server and delete file in remove server after downloaded. - only download specify filename - auto upload file from local to SFTP remote server and delete local folder file after uploaded - only upload specify filename ... (3 Replies)
Discussion started by: weesiong
3 Replies

2. Shell Programming and Scripting

Number of elements, average value, min & max from a list of numbers using awk

Hi all, I have a list of numbers. I need an awk command to find out the numbers of elements (number of numbers, sort to speak), the average value the min and max value. Reading the list only once, with awk. Any ideas? Thanks! (5 Replies)
Discussion started by: black_fender
5 Replies

3. Shell Programming and Scripting

Based on the first & last timestamp of the file, need to calculate the time taken to complete

Below is the sample file: 287 DEBUG syndesis.pb.util.ITraceManager - syOID=ELntNetwork:1005Mon Oct 15 17:18:21 IST 2012 <ELClientManagerenEmsSession() > Setting Java Properties 287 DEBUG syndesis.pb.util.ITraceManager - syOID=ELntNetwork:1005Mon Oct 15 17:18:21 IST 2012... (1 Reply)
Discussion started by: ashok.kumar
1 Replies

4. Shell Programming and Scripting

Write a scripts to kill idle user for 60 min. & email user list to admin in text file

Folks, I have written one script for following condition by referring some of online post in this forum. Please correct it if I'm missing something in it. (OS: AIX 5.3) List the idle user. (I used whoidle command to list first 15 user and get username, idle time, pid and login time).... (4 Replies)
Discussion started by: sumit30
4 Replies

5. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

6. Shell Programming and Scripting

replace & with &amp; xml file

Hello All I have a xml file with many sets of records like this <mytag>mydata</mytag> <tag2>data&</tag2> also same file can be like this <mytag>mydata</mytag> <tag2>data&</tag2> <tag3>data2&amp;data3</tag3> Now i can grep & and replace with &amp; for whole file but it will replace all... (4 Replies)
Discussion started by: lokaish23
4 Replies

7. UNIX for Dummies Questions & Answers

How to calculate the percentage/fraction of each value in a row against the maximum row value?

Hi, For each row in a file, i would like to identify the maximum value and calculate the percentage/fraction of the max for other values in the row. Then, I would like to print a copy of the file where values above a threshold are replaced with "1" and other values are left as "0". In the... (2 Replies)
Discussion started by: auburn
2 Replies

8. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

9. UNIX for Dummies Questions & Answers

Script producing error, Program to calculate maximum number

Hi folks, Here i have written a shell script to calculate a maximum number from 10 numbers entered on command line. max=0 echo Enter 10 numbers , one at a time for i in 1 2 3 4 5 6 7 8 9 10 do read n max=`expr $max + $n` if --- At this last step there is some problem, it gives error... (5 Replies)
Discussion started by: rits
5 Replies

10. Linux

maximum file & directories

Dear friends, How many maximum number of files and directories can be created in linux system. Thanks.. (2 Replies)
Discussion started by: karthigayan
2 Replies
Login or Register to Ask a Question