May I propose a few enhancements/corrections to elixir_sinari's post:
a) c will be identical to NR even if empty lines are encountered, so it can be replaced by NR and left out OR we need to check for empty lines, e.g. NF>0.
b) min and max will be empty and either of them will stay empty as long as 0 is not traversed. They should be initialized.
c) min and/or max will be distorted by empty lines, so a check for that will be mandatory.
Pls try:
Last edited by RudiC; 11-10-2012 at 08:54 AM..
Reason: small corrections to text and code (replaced <= by <, >= by > for min/max)
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)
hi!
i have a file like the attachement.
I'd like to get for each line the min, max and average values. (there is 255 values for each line)
how can i get that ?
i try this, is it right?
BEGIN {FS = ","; OFS = ";";max=0;min=0;moy=0;total=0;freq=890}
$0 !~ /Trace1:/ {
... (1 Reply)
I am redirecting my ping output to a file. The sample output is like this:
64 bytes from xx.xx.xx.167: icmp_seq=4490 ttl=116 3.75 ms 2011Jul12- 15 40 16
64 bytes from xx.xx.xx.167: icmp_seq=4491 ttl=116 5.29 ms 2011Jul12- 15 40 17
64 bytes from xx.xx.xx.167: icmp_seq=4492 ttl=116 4.88 ms... (6 Replies)
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)
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 want to create a form with data values in a dropdown list. The values in the dropdown list need to be generated on the fly from max, min and increment values contained in a mysql database.
Hopefully this makes sense, I really have no idea where to start :confused:
Thanks (6 Replies)
Hi to all,
Please help on the following problem, I'm not where to begin, if awk or shell script.
I have pairs of ranges of numbers and I need to find the root or roots of ranges based on min Range and Max ranges
Example #1:
If min range is 120000 and max ranges 124999, it means that are... (5 Replies)
Discussion started by: Ophiuchus
5 Replies
LEARN ABOUT MOJAVE
lam
LAM(1) BSD General Commands Manual LAM(1)NAME
lam -- laminate files
SYNOPSIS
lam [-f min.max] [-s sepstring] [-t c] file ...
lam [-p min.max] [-s sepstring] [-t c] file ...
DESCRIPTION
The lam utility copies the named files side by side onto the standard output. The n-th input lines from the input files are considered frag-
ments of the single long n-th output line into which they are assembled. The name `-' means the standard input, and may be repeated.
Normally, each option affects only the file after it. If the option letter is capitalized it affects all subsequent files until it appears
again uncapitalized. The options are described below:
-f min.max
Print line fragments according to the format string min.max, where min is the minimum field width and max the maximum field width.
If min begins with a zero, zeros will be added to make up the field width, and if it begins with a `-', the fragment will be left-
adjusted within the field.
-p min.max
Like -f, but pad this file's field when end-of-file is reached and other files are still active.
-s sepstring
Print sepstring before printing line fragments from the next file. This option may appear after the last file.
-t c The input line terminator is c instead of a newline. The newline normally appended to each output line is omitted.
To print files simultaneously for easy viewing use pr(1).
EXAMPLES
The command
lam file1 file2 file3 file4
joins 4 files together along each line. To merge the lines from four different files use
lam file1 -S "
" file2 file3 file4
Every 2 lines of a file may be joined on one line with
lam - - < file
and a form letter with substitutions keyed by `@' can be done with
lam -t @ letter changes
SEE ALSO join(1), paste(1), pr(1), printf(3)STANDARDS
Some of the functionality of lam is standardized as the paste(1) utility by IEEE Std 1003.2 (``POSIX.2'').
BUGS
The lam utility does not recognize multibyte characters.
BSD August 12, 2004 BSD