Sponsored Content
Top Forums Shell Programming and Scripting Print root number between min and max ranges Post 302960351 by RudiC on Saturday 14th of November 2015 10:16:44 AM
Old 11-14-2015
Any attempts from your side?

---------- Post updated at 12:32 ---------- Previous update was at 10:54 ----------

Howsoever, try
Code:
awk '
NR > 1  {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
0
1
14
15
16
17
18
19
3
4
5
6
120
121
122
123
124
2
57

, including your examples #1 - #3 into the range file.

---------- Post updated at 12:46 ---------- Previous update was at 12:32 ----------

Handling of the first range line (field 1 being "000000") needs some special treatment; insert if (substr($1,1,1)=="0") {print 0; $1="1" substr($1,2)} just before DELTA is calculated.
This User Gave Thanks to RudiC 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
dlaed5.f(3)							      LAPACK							       dlaed5.f(3)

NAME
dlaed5.f - SYNOPSIS
Functions/Subroutines subroutine dlaed5 (I, D, Z, DELTA, RHO, DLAM) DLAED5 Function/Subroutine Documentation subroutine dlaed5 (integerI, double precision, dimension( 2 )D, double precision, dimension( 2 )Z, double precision, dimension( 2 )DELTA, double precisionRHO, double precisionDLAM) DLAED5 Purpose: This subroutine computes the I-th eigenvalue of a symmetric rank-one modification of a 2-by-2 diagonal matrix diag( D ) + RHO * Z * transpose(Z) . The diagonal elements in the array D are assumed to satisfy D(i) < D(j) for i < j . We also assume RHO > 0 and that the Euclidean norm of the vector Z is one. Parameters: I I is INTEGER The index of the eigenvalue to be computed. I = 1 or I = 2. D D is DOUBLE PRECISION array, dimension (2) The original eigenvalues. We assume D(1) < D(2). Z Z is DOUBLE PRECISION array, dimension (2) The components of the updating vector. DELTA DELTA is DOUBLE PRECISION array, dimension (2) The vector DELTA contains the information necessary to construct the eigenvectors. RHO RHO is DOUBLE PRECISION The scalar in the symmetric updating formula. DLAM DLAM is DOUBLE PRECISION The computed lambda_I, the I-th updated eigenvalue. Author: Univ. of Tennessee Univ. of California Berkeley Univ. of Colorado Denver NAG Ltd. Date: November 2011 Contributors: Ren-Cang Li, Computer Science Division, University of California at Berkeley, USA Definition at line 109 of file dlaed5.f. Author Generated automatically by Doxygen for LAPACK from the source code. Version 3.4.1 Sun May 26 2013 dlaed5.f(3)
All times are GMT -4. The time now is 05:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy