awk Sort 2d histogram output from min(X,Y) to max(X,Y)
I've got Gnuplot-format 2D histogram data output which looks as follows.
The section in bold shows that for each value of Y, a set of bins is defined with varying X values.
QUESTION: I need the data re-sorted to go from min(X,Y) to max(X,Y). The data must never be decreasing, always equal or incremental records. I.e. resort structure to cover incremental pairs (X,Y)
did not work
DESIRED OUTPUT
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by RudiC; 11-15-2016 at 02:42 PM..
Reason: Added CODE tags.
hi, i have an awk script and I managed to figure out how to search the max value but Im having difficulty in searching for the min field value.
BEGIN {FS=","; max=0}
NF == 7 {if (max < $6) max = $6;}
END { print man, min}
where $6 is the column of a field separated by a comma (3 Replies)
I'm trying to iterate a UNIX awk script that returns min/max temperature data for each day from a monthly weather data file (01_weath.dat). The temperature data is held in $5. The temps are reported each minute so each day contains 1440 temperature enteries. The below code has gotten me as far as... (5 Replies)
Hi guys!
I'm new to scripting and I need to write a script in awk.
Here is example of file on which I'm working
ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00
ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00
ATOM 4690 CD ... (18 Replies)
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)
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)
aaa: 3 ms
aaa: 2 ms
aaa: 5 ms
aaa: 10 ms
..........
to get the 3 2 5 10 ...'s min avg and max
something like
min: 2 ms avg: 5 ms max: 10 ms (2 Replies)
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)
Hi,
I need your kind help to get min and max values from file based on value in $5 .
File1
SP12.3 stc 2240806 2240808 + ID1_N003 ID2_N003T0
SP12.3 sto 2241682 2241684 + ID1_N003 ID2_N003T0
SP12.3 XE 2239943 2240011 + ID1_N003 ID2_N003T0
SP12.3 XE 2240077 2241254 + ID1_N003 ... (12 Replies)
I am trying to get a simple min/max script to work with the below input. Note the special character (">") within it.
Script
awk 'BEGIN{max=0}{if(($1)>max) max=($1)}END {print max}'
awk 'BEGIN{min=0}{if(($2)<min) min=($2)}END {print min}'
Input
-122.2840 42.0009
-119.9950 ... (7 Replies)
Discussion started by: ncwxpanther
7 Replies
LEARN ABOUT ULTRIX
pnmhistmap
pnmhistmap(1) General Commands Manual pnmhistmap(1)NAME
pnmhistmap - draw a histogram for a PGM or PPM file
SYNOPSIS
pnmhistmap [-black] [-white] [-max N] [-verbose] [pnmfile]
DESCRIPTION
Reads a portable anymap as input, although bitmap (PBM) input produces an error message and no image. Produces an image showing a his-
togram of the color (or gray) values in the input. A graymap (PGM) input produces a bitmap output. A pixmap (PPM) input produces pixmap
output with three overlaid histograms: a red one for the red input, a green one for the green input, and a blue one for the blue input.
The output is fixed in size: 256 pixels wide by 200 pixels high.
OPTIONS -black Ignores the count of black pixels when scaling the histogram.
-white Ignores the count of white pixels when scaling the histogram.
The -black and -white options, which can be used seperately or together, are useful for images with a large percentage of pixels whose
value is zero or 255, which can cause the remaining histogram data to become unreadbaly small. Note that, for pixmap inputs, these options
apply to all colors; if, for example, the input has a large number of bright-red areas, you will probably want to use the -white option.
-max N Force the scaling of the histogram to use N as the largest-count value. This is useful for inputs with a large percentage of sin-
gle-color pixels which are not black or white.
-verbose
Report the progress of making the histogram, including the largest-count value used to scale the output.
All flags can be abbreviated to their shortest unique prefix.
BUGS
Assumes maxval is always 255. Images with a smaller maxval will only use the lower-value side of the histogram. This can be overcome
either by piping the input through "pnmdepth 255" or by cutting and scaling the lower-value side of the histogram. Neither is a particu-
larly elegant solution.
Should allow the output size to be specified.
SEE ALSO pgmhist(1), ppmhist(1), pgm(5), ppm(5)AUTHOR
Wilson H. Bent. Jr. (whb@usc.edu).
25 October 1993 pnmhistmap(1)