Sponsored Content
Top Forums Shell Programming and Scripting Print root number between min and max ranges Post 302960381 by Aia on Saturday 14th of November 2015 07:08:37 PM
Old 11-14-2015
Your input files are not consistent.

Your original input file has a header line with Min-Range Max Range
Quote:
Min-Range Max Range
000000 999999
100000 199999
140000 199999
300000 699999
The second input file you are complaining about does not have that header line.
Quote:
300000 309999
310000 319999
320000 320999
321000 321999
322000 322899
The script suggested was created to accommodate that header line.
Try with that constrain removed.
Code:
awk '
        {DELTA = $2 - $1
         n=split (DELTA, T, "")
         for (i=1; i<=n; i++) if (T[i] == "9") break
         B = 0 + substr ($1, 1, length($1) - length(DELTA) + i - 1)
         E = 0 + substr ($2, 1, length($2) - length(DELTA) + i - 1)
         for (i=B; i<=E; i++) print i
        }
' file

This User Gave Thanks to Aia For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to print mon and max values of ranges

HI all I'm trying to write an awk script to print the min and max value in a range(s) contained in another file - the range values are in $2 EG 114,7964,1,y,y,n 114,7965,1,y,y,n 114,7966,1,y,y,n 114,7967,1,y,y,n 114,7969,1,y,y,n 114,7970,1,y,y,n 114,7971,1,y,y,n 114,7972,1,y,y,n... (3 Replies)
Discussion started by: Mudshark
3 Replies

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

3. Shell Programming and Scripting

get min, max and average value

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)
Discussion started by: riderman
1 Replies

4. Shell Programming and Scripting

print max number of 2 columns - awk

Is it possible to print max number of 2 columns - awk note: print max if the integer is positive and print min if the integer is negative input a 1 2 b 3 4 c 5 1 d -3 -5 d -5 -3 output a 2 b 4 c 5 d -5 d -5 (4 Replies)
Discussion started by: quincyjones
4 Replies

5. UNIX for Dummies Questions & Answers

[Solved] Print a line using a max and a min values of different columns

Hi guys, I already search on the forum but i can't solve this on my own. I have a lot of files like this: And i need to print the line with the maximum value in last column but if the value is the same (2 in this exemple for the 3 last lines) i need get the line with the minimum value in... (4 Replies)
Discussion started by: MetaBolic0
4 Replies

6. Shell Programming and Scripting

Print min and max value from two column

Dear All, I have data like this, input: 1254 10125 1254 10126 1254 10127 1254 10128 1254 10129 1255 10130 1255 10131 1255 10132 1255 10133 1256 10134 1256 10135 1256 10137... (3 Replies)
Discussion started by: aksin
3 Replies

7. Shell Programming and Scripting

Print numbers between two number ranges

Hi, I have a list.txt file with number ranges and want to print/save new all.txt file with all the numbers and between the numbers. == list.txt == 65936 65938 65942 && 65943 65945 ... (7 Replies)
Discussion started by: AK47
7 Replies

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

9. Programming

Php number array from max, min, step size mysql data

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)
Discussion started by: barrydocks
6 Replies

10. UNIX for Beginners Questions & Answers

Print a row with the max number in a column

Hello, I have this table: chr1_16857_17742 - chr1 17369 17436 "ENST00000619216.1"; "MIR6859-1"; - 67 chr1_16857_17742 - chr1 14404 29570 "ENST00000488147.1"; "WASH7P"; - 885 chr1_16857_18061 - chr1 ... (5 Replies)
Discussion started by: coppuca
5 Replies
JAAA(1) 						      General Commands Manual							   JAAA(1)

NAME
jaaa -- JACK and ALSA Audio Analyser SYNOPSIS
jaaa [-h] [-C nchan] [-J] [-A [-ddevice] [-rrate] [-pperiod] [-nnfraqs] ] DESCRIPTION
jaaa is an audio signal generator and spectrum analyser designed to make accurate measurements. OPTIONS
-h Show summary of options. -C Number of channels (1..8) [4 -J Use JACK -A Use ALSA (with following options) -d device Alsa device [hw:0.0] -r rate Sample frequency [48000] -p period Period size [1024] -n nfrag Number of fragments [2] Either -J or -A must be given. INTERACTIVE CONTROL
Input : Select on of the four inputs. Frequency and Amplitude : These two sets of buttons set the display view. One of these six buttons, or 'Bandw', 'Peak', or 'Noise' discussed below, has an orange LED at its left side. The LED indicates the 'currenty selected parameter' that usually can be modified in three ways : o by typing a new value into the text widget, followed by ENTER o by using the '<' or '>' buttons to decrement or increment, o by mouse gestures Frequency : Buttons 'Min' and 'Max' set the min and max displayed frequencies. If either of these is selected then o a horizontal Drag Left changes 'Min' o a horizontal Drag Right changes 'Max' Button 'Cent' is the frequency at the middle of the x-axis. Button 'Span' is 'Max' - 'Min', changing this value preserves 'Cent'. If either of these is selected then o a horizontal Drag Left changes 'Cent' o a horizontal Drag Right changes 'Span' Button 'Cent' can also be set by Clicking in the frequency axis scale. Amplitude : Button 'Max' is the maximum value on the y-axis. Button 'Range' is the range of the y-axis. If either of these is selected then o a vertical Drag Left changes 'Max' o a vertical Drag Right changes 'Range' So for the last four mouse gestures, a Drag Left will scroll the display, while a Drag Right will zoom in or out. Maybe I will add and automatic selection of the axis based on the direction of the mouse gesture. Analyser : The analyser is based on a windowed FFT. Actually the windowing is performed by convolution after the FFT, and combined with interpola- tion. The windowing and interpolation ensure that displayed peaks will be accurate to 0.25 dB even if the peak falls between the FFT bins. More accurate measurements can be made using the markers (see below). Button 'Bandw' sets the FFT length, and hence the bandwidth of the analyser. Depending on this value, the size of the display and the frequency range, you may sometimes see two traces. This happens when the resolution of the analyser is better than the display, so that one pixel contains more than one analyser value. In that case, the blue trace is the peak value over the frequency range represented by each pixel, and the gray one is the average value. The first one is correct for discrete frequencies, and the latter should be used to read noise densities. There is no mouse gesture to change the bandwidth. Button 'VidAv' or video average, when switched on, averages the measured energy over time. This is mainly used to measure noise. The averaging length increases over time, to a maxumum of 1000 iterations. Changing the input or bandwidth resets and restarts the averaging. Button 'Freeze' freezes the analyser, but not the display, so you can still scroll and zoom or use the markers discussed below. Markers : Markers are used in order to accurately read off values in the display. There can be up to two markers, set by clicking at the desired frequency inside the display. When there are two markers, the second one will move with each click, while the first remains fixed. Mea- sured values for the two markers, and their difference in frequency and level are displayed in the upper left corner of the display. Button 'Clear' clears the markers. When 'Peak' is selected, clicking inside the display will set a marker at the nearest peak. The exact frequency and level of the peak are found by interpolation, so the frequency can be much more accurate than the FFT step, and the level corresponds to the true peak value regardless of display or analyser resolution. When 'Noise' is selected, clicking inside the display will set a noise marker. The noise density (energy per Hz) is calculated and displayed. SEE ALSO
jackd (1) WWW
http://www.kokkinizita.net/linuxaudio/ AUTHOR
This manual page was written by Philippe Coval rzr@gna.org for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. JAAA(1)
All times are GMT -4. The time now is 04:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy