Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Problem with ranges of numbers Post 302536068 by shizik on Monday 4th of July 2011 04:15:47 AM
Old 07-04-2011
hmmm
my system didn't know command seq: (No manual entry for seq.)

can you write me this script on awk?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

problem with floating point numbers in awk

hi all, i have the following problem using awk in a script i want to read the values from a column with real numbers and calculate the mean.the problem is that when i use a statement such as this num = $4 i cant find a way to convert the variable from string to floating point to perform... (7 Replies)
Discussion started by: kanagias
7 Replies

2. Shell Programming and Scripting

grep or awk problem, unable to extract numbers

Hi, I've trouble getting some numbers from a html-file. The thing is that I have several html-logs that contains lines like this: nerdnerd, how_old_r_u:45782<br>APPLY: <hour_second> Verification succeded This is some of what I've extracted from a html file but all I really want is the number... (7 Replies)
Discussion started by: baghera
7 Replies

3. UNIX for Dummies Questions & Answers

Awk ranges for selecting numbers

Hi, I am trying to use AWK to do some editing and formating of large tables of numbers and I am having trouble getting it to work. For brevities sake, I won't show the whole table, but I have a sample set of code: und$ awk '{($2+0) > 50;print $1}' temp 2000 147 2008 128 2002 100 1999 47... (2 Replies)
Discussion started by: ikerrin1@gmail.
2 Replies

4. Shell Programming and Scripting

Problem with sub command (awk) and numbers

Hi, I am trying to perform a simple soustraction between two floating numbers and cannot get it done for some reason due to the use of the sub command. The following is the straight-forward result of the soustraction: $ echo | gawk '{a=968;b=967.99;c=a-b;print c}' ... (2 Replies)
Discussion started by: Indalecio
2 Replies

5. Shell Programming and Scripting

Problem with format numbers

Hello Everyone! I hope you can help me!! I have this little problem: I executed oracle query and the output of the result are in a text file called "DATAFILE.txt", and the value of file is: 97.37 Well, the script compare the result in text file with a condition: ... (5 Replies)
Discussion started by: bobbasystem
5 Replies

6. UNIX for Dummies Questions & Answers

Magic numbers '&' operator problem

Hello everyone, on the man page of "magic(5)" There is explanation "&, to specify that the value from the file must have set all of the bits that are set in the specified value" . My question is that what is the difference between '&' and equal operator '=' ? I tested it with file... (6 Replies)
Discussion started by: segmentation
6 Replies

7. UNIX for Dummies Questions & Answers

Magic numbers string/B problem

Hello, In manpage magic(5) " The “B” flag compacts whitespace in the target, which must contain at least one whitespace character. If the magic has n consecutive blanks, the target needs at least n consecutive blanks to match. The “b” flag treats every blank in the target as an optional... (4 Replies)
Discussion started by: segmentation
4 Replies

8. Shell Programming and Scripting

Problem with numbers in exponential format

Hi I have a shell scribt with some numbers in exponential format, for example, "1.23456789E +01" Now I would like to bring these numbers into a format without the E. Can someone help me Thanks Flo ---------- Post updated at 10:07 AM ---------- Previous update was at 09:14 AM... (1 Reply)
Discussion started by: sbfly
1 Replies

9. Shell Programming and Scripting

Values between ranges

Hi, I have two files file1 chr1_22450_22500 chr2_12300_12350 chr1_34500_34550 file2 11000_13000 15000_19000 33000_44000 If the file 1 ranges fall between file2 ranges then assign the value of file2 in column 2 to file1 output: chr2_12300_12350 11000_13000 chr1_34500_34550 ... (7 Replies)
Discussion started by: Diya123
7 Replies

10. 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
Number::Range(3pm)					User Contributed Perl Documentation					Number::Range(3pm)

NAME
Number::Range - Perl extension defining ranges of numbers and testing if a number is found in the range. You can also add and delete from this range. SYNOPSIS
use Number::Range; my $range = Number::Range->new("-10..10,12,100..120"); if ($range->inrange("13")) { print "In range "; } else { print "Not in range "; } $range->addrange("200..300"); $range->delrange("250..255"); my $format = $range->range; # $format will be '-10..10,12,100..120,200..249,256..300' DESCRIPTION
Number::Range will take a description of a range, and then allow you to test on if a number falls within the range. You can also add and delete from the range. RANGE FORMAT The format used for range is pretty straight forward. To separate sections of ranges it uses a "," or whitespace. To create the range, it uses ".." to do this, much like Perl's own binary ".." range operator in list context. METHODS new $range = Number::Range->new("10..20","25..30"); Creates the range object. It will accept any number of ranges as its input. addrange $range->addrange("22"); This will also take any number of ranges as input and add them to the existing range. delrange $range->delrange("10"); This will also take any number of ranges as input and delete them from the existing range. inrange $range->inrange("26"); my @results = $range->inrange("27","200"); This will take one or more numbers and check if each of them exists in the range. If passed a list, and in array context, it will return a list of 0's or 1's, depending if that one was true or false in the list position. If in scalar context, it will return a single 1 if all are true, or a single 0 if one of them failed. range $format = $range->range; @numbers = $range->range; Depending on context this will return either an array of all the numbers found in the range, for list context. For scalar context it will return a range string. size $size = $range->size; This will return the total number of entries in the range. EXPORT None by default. SEE ALSO
Number::Tolerant, Tie::RangeHash, and Array::IntSpan for similar modules. AUTHOR
Larry Shatzer, Jr., <larrysh@cpan.org> COPYRIGHT AND LICENSE
Copyright (C) 2004-12 by Larry Shatzer, Jr. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-20 Number::Range(3pm)
All times are GMT -4. The time now is 11:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy