Sponsored Content
Top Forums Shell Programming and Scripting how to find min, max dates in a file Post 302175877 by radoulov on Sunday 16th of March 2008 01:59:23 PM
Old 03-16-2008
Another Awk solution:

Code:
awk 'END { for (k in min) 
printf "%s %s\n%s %s\n\n", 
k, min[k], k, max[k] }
!x[$1]++ { min[$1] = $3 }
fmtd($3) > fmtd(max[$1]) { max[$1] = $3 }
fmtd($3) < fmtd(min[$1]) { min[$1] = $3 } 
func fmtd(dt) { split(dt, t, "/") 
  return t[3]t[1]t[2] 
}' FS="," file

Use nawk or /usr/xpg4/bin/awk on Solaris.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

min and max value of process id

We are running a AIX 5.2 OS. Would anyone happen to know what the max value for a process id could be? Thanks jerardfjay :) (0 Replies)
Discussion started by: jerardfjay
0 Replies

2. UNIX for Dummies Questions & Answers

How to find whenther given value is in betwwen min and Max in unix shell scripting

Hi I wanted to write a shell script with an if condition Example MinValue=10 MaxValue=30 logvalue = some integer value that script reads from the command line arguement I wanted to check whether log value greater than or equal to10 and less than equal to 30 and proceed with the rest of... (5 Replies)
Discussion started by: pinky
5 Replies

3. Shell Programming and Scripting

To get max/min Date/Timestamp from a file

I want to get maximum/minimum date/timestamp from a data file ? Sample Input File ============= rec#,order_dt,ext_ts 1,2010-12-01,2010-12-01 17:55:23.222222 2,2011-11-05,2010-12-01 19:55:23.222222 3,2009-10-01,2010-12-01 18:55:23.222222 for above file Maximum Order_dt = 2011-11-05... (5 Replies)
Discussion started by: vikanna
5 Replies

4. Shell Programming and Scripting

Find min.max value if matching columns found using AWK

Input_ File : 2 3 4 5 1 1 0 1 2 1 -1 1 2 1 3 1 3 1 4 1 6 5 6 6 6 6 6 7 6 7 6 8 5 8 6 7 Desired output : 2 3 4 5 -1 1 4 1 6 5 6 8 5 8 6 7 (3 Replies)
Discussion started by: vasanth.vadalur
3 Replies

5. Shell Programming and Scripting

How to find the average,min,max ,total count?

Hi , Below is my sample data,I have this 8 column(A,B,C,D,E,F,G,H) in csv file. A , B ,C ,D ,E ,F,G ,H 4141,127337,24,15,20,69,72.0,-3 4141,128864,24,15,20,65,66.0,-1 4141,910053,24,15,4,4,5.0,-1 4141,910383,24,15,22,3,4.0,-1 4141,496969,24,15,14,6,-24.0,-18... (7 Replies)
Discussion started by: vinothsekark
7 Replies

6. 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

7. Homework & Coursework Questions

Min/Max/counter/while loop from file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: The program is supposed to read in text from a given file ( different samples provided in the homework but not... (1 Reply)
Discussion started by: c++newb
1 Replies

8. Shell Programming and Scripting

Average, min and max in file with header, using awk

Hi, I have a file which looks like this: FID IID MISS_PHENO N_MISS N_GENO F_MISS 12AB43131 12AB43131 N 17774 906341 0.01961 65HJ87451 65HJ87451 N 10149 906341 0.0112 43JJ21345 43JJ21345 N 2826 906341 0.003118I would... (11 Replies)
Discussion started by: kayakj
11 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 min and max time taken from a log file

You have a log file as attached in sample input with various operations and time taken by each of them. Write a script to find the min and max time taken for each operation. Sample output is attached. Sample Input is given as below: operation1,83621 operation2,72321 operation3,13288... (1 Reply)
Discussion started by: Chandan_Bose
1 Replies
lockward(6x)							XScreenSaver manual						      lockward(6x)

NAME
lockward - Rotating spinning color-cycling things SYNOPSIS
lockward [-display displayspec] [-root] [-window] [-visual arg] [-window-id arg] [-delay usec] [-pair] [-fps] [-blink | -no-blink] [-rotateidle-min msec] [-rotateidle-max msec] [-blinkidle-min msec] [-blinkidle-max msec] [-blinkdwell-min msec] [-blinkdwell-max msec] DESCRIPTION
lockward draws a spinning, rotating set of notched wheels overlaid with some flashing effects, using OpenGL. It's a sort of cross between the wards in a combination lock and those old information displays that animated via polarized light. OPTIONS
-visual visual Specify which visual to use. Legal values are the name of a visual class, or the ID number (decimal or hex) of a specific visual. -window Draw on a newly-created window (default). -root Draw on the root window. -delay microseconds Per-frame delay, in microseconds. Default: 20000 (50 frames/sec). -blink | -no-blink Enables/disables the blinking effects. Default: Enabled. -fps Display the current frame rate, CPU load, and polygon count. -rotateidle-min milliseconds -rotateidle-max milliseconds The minimum and maximum time each spinner will sit idle, in milliseconds. Defaults: Min 1000, max 6000. -blinkidle-min milliseconds -blinkidle-max milliseconds The minimum and maximum time between blinking effects, in milliseconds. Defaults: Min 1000, max 9000. -blinkdwell-min milliseconds -blinkdwell-max milliseconds The minimum and maximum dwell time for the blinking effects, in milliseconds. This affects how quickly the blinks actually happen. Defaults: Min 100, max 600. ENVIRONMENT
DISPLAY Default host and display number. XENVIRONMENT Name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. SEE ALSO
X(1), xscreensaver(1) AUTHORS
Leo L. Schwab <ewhac@best.com> X Version 11 5.15 (28-Sep-2011) lockward(6x)
All times are GMT -4. The time now is 11:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy