Sponsored Content
Full Discussion: Find max value problem
Top Forums Shell Programming and Scripting Find max value problem Post 302657537 by itkamaraj on Monday 18th of June 2012 02:25:54 AM
Old 06-18-2012
just sort by second column, and retrieve the first value by head -1
Code:
 
$ sort -nr -k2 input.txt
11:38:09 0.17
11:34:01 0.10
11:39:48 0.06
11:35:59 0.06
11:34:37 0.05
11:35:13 0.03
11:38:00 0.02

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to find min, max dates in a file

hello friends...:-) i need some help i have a file cantain like this Star1 ,NetWork,09/02/2008 Star1 ,NetWork,10/02/2008 Star1 ,NetWork,11/02/2008 Star2 ,NetWork,08/03/2008 Star2 ,NetWork,09/04/2008 Star2 ,NetWork,10/05/2008 i need to find out min, max dates the output look like... (6 Replies)
Discussion started by: gemini106
6 Replies

2. Shell Programming and Scripting

find max number

Hi, i have a file with numbers in it and i was wondering if there's a script i could use to find the max number and have that printed to a new file? example a.txt 18 26 47 34 27 so find the max number in a.txt and print it to b.txt. Thanks! (17 Replies)
Discussion started by: moonbaby
17 Replies

3. Shell Programming and Scripting

Find max number in a set

Is there a simple way of calculating the max number in a set of variables, so a=1 b=3 c=6 d=30 something that says e=max($a, $b, $c, $d) I've found a way to do it using: a="1" b="3" c="5" d="50" if ; then t=$a else (3 Replies)
Discussion started by: unclecameron
3 Replies

4. Shell Programming and Scripting

How to find max value in a tabular data?

FILE_NAME VER TYPE DELETED_DATE CREATED_DATE SIZE LOCATION hello 1 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ hello 2 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ hello 3 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ hello 4 d 2010-08-09 2010-08-09 4096 /home/xxxxx/project/ ... (4 Replies)
Discussion started by: classic
4 Replies

5. Shell Programming and Scripting

to find min and max value for each column!

Hello Experts, I have got a txt files which has multiple columns, I want to get the max, min and diff (max-min) for each column in the same txt file. Example: cat file.txt a 1 4 b 2 5 c 3 6 I want ouput like: cat file.txt a 1 4 b 2 5 c 3 6 Max 3 6 Min 1 4 Diff 2 2 awk 'min=="" ||... (4 Replies)
Discussion started by: dixits
4 Replies

6. Shell Programming and Scripting

Find the numeric value in a string and then check the max. value

hi, i have a string " 00000069 ThreadMonitor W WSVR0606W: Thread "WebContainer : 43|null" (00000069) was previously rep orted to be hung but has completed. It was active for approximately 47533430 milliseconds. There is/are 43 thread(s) in tot al in the server that still may be hung." ... (4 Replies)
Discussion started by: lovelysethii
4 Replies

7. Shell Programming and Scripting

awk to find the max

Experts, Here is my question. I have got file like below # cat file XYZb,24,26,6 XYZc,24,26,6 XYZe,24,25,5 XYZf,23,29,5 XYZi,16,25,5 XYZj,24,26,7 XYZn,17,23,4 XYZz,23,29,5 Now, I want to print the line's Column1 whose Column 3 is the max of all. My code is awk -F',' 'BEGIN {max... (9 Replies)
Discussion started by: sathyaonnuix
9 Replies

8. Shell Programming and Scripting

Find max length of the field and then replace zero

hai guys, pick the 1st field and calculate max length. if suppose max length is 2, then compare the all records if <2 then add zero's prefix of the record. for ex: s.no,sname 1,djud 37,jtuhe in this max length of the 1st field is 2 right the output wil be s.no,sname 01,djud... (6 Replies)
Discussion started by: Suneelbabu.etl
6 Replies

9. Shell Programming and Scripting

awk script to find min and max value

I need to find the max/min of columns 1 and 2 of a 2 column file what contains the special character ">". I know that this will find the max value of column 1. awk 'BEGIN {max = 0} {if ($1>max) max=$1} END {print max}' input.file But what if I needed to ignore special characters in the... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

10. Shell Programming and Scripting

Find Max value of line and print

I need to find the max value of all columns except the 1st column and print the answer along with the 1st column. Input 123xyz 0 0 1 2 0 0 0 0 0 0 0 234xyz 0 0 0 0 0 0 0 0 0 0 0 345xyz 0 0 1 0 0 0 ... (8 Replies)
Discussion started by: ncwxpanther
8 Replies
PMIE2COL(1)						      General Commands Manual						       PMIE2COL(1)

NAME
pmie2col - convert pmie output to multi-column format SYNOPSIS
pmie2col [-d delimiter] [-p precision] [-w width] DESCRIPTION
pmie2col is a simple tool that converts output from pmie(1) into regular column format. Each column is 7 characters wide (by default, may be changed with the -w option) with a single space between columns. That single space can be substituted with an alternate delimiter using the -d option (this is useful for importing the data into a spreadsheet, for example). The precision of the tabulated values from pmie can be specified with the -p option (default is 2 decimal places). This option can and will override any width setting in order to present the requested precision. The pmie(1) configuration must follow these rules: (1) Each pmie(1) expression is of the form ``NAME = expr;''. NAME will be used as the column heading, and must contain no white space, although special characters can be escaped by enclosing NAME in single quotes. (2) The ``expr'' must be a valid pmie(1) expression that produces a singular value. In addition, pmie(1) must be run with the -v command line option. It is also possible to use the -e command line to pmie(1) and output lines will be prefixed by a timestamp. EXAMPLE
Given this pmie(1) configuration file (config): loadav = kernel.all.load #'1 minute'; '%usr' = kernel.all.cpu.user; '%sys' = kernel.all.cpu.sys; '%wio' = kernel.all.cpu.wait.total; '%idle' = kernel.all.cpu.idle; 'max-iops' = max_inst(disk.dev.total); Then this command pipeline: $ pmie -v -t 5 <config | pmie2col -w 8 Produces output like this: loadav %usr %sys %wio %idle max-iops 0.21 ? ? ? ? ? 0.36 0.49 0.03 0.18 0.29 25.40 0.49 0.41 0.10 0.36 0.13 51.00 0.69 0.49 0.10 0.05 0.37 43.20 0.71 0.39 0.08 0.04 0.49 14.00 0.83 0.63 0.15 0.00 0.21 32.30 1.09 0.60 0.02 0.10 0.27 47.00 0.92 0.01 0.00 0.00 0.99 2.40 PCP ENVIRONMENT
Environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP. On each installation, the file /etc/pcp.conf contains the local values for these variables. The $PCP_CONF variable may be used to specify an alternative configura- tion file, as described in pcp.conf(5). SEE ALSO
PCPIntro(1) and pmie(1). Performance Co-Pilot PCP PMIE2COL(1)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy