I have a text file with lines that look like this:
I want awk to search the 2nd field (which represents months) and spit out lines where that field's numeric value falls within a certain range. My code for this is:
This works great for, say, the range 6-9, but the problem is that for a month system, the numbers 1 and 2 will be matched in the numbers 10, 11, and 12, so a search for "1-3" (January-March) will return October, November, and December values that I don't want. I have tried forcing only a 1-digit match using:
...but that doesn't work(it returns nothing), and even if it did, it would eliminate searches for double-digit months like "10-12". Is there a way for me to get awk to search only for exact matches within the numerical range? Any help would be appreciated.
I have two files.And a sort of matrix analysis.
Both files have a string followed by two numbers:
File 1:
A 2 7
B 3 11
C 5 10
......
File 2:
X 1 10
Y 3 5
Z 5 9
What I'd like to do is for each set of numbers in the second file indicate if the first or second number (or both) in... (7 Replies)
if the column1 and 2 in both files has same key (for example "a" and "a1") compare each first key value(a1 of a) of input2 (for example 1-4 or 65-69 not 70-100 or 44-40 etc) with all the values in input1.
if the range of first key value in input2 is outof range in input1 values named it as out... (54 Replies)
hi Experts
just wondering if you can help me check a number between a specific range
if i have an ip address , how can i say the valid number for ip between 1 to 254
something like this
if ($ip ) =~ /.../
{
}
what the pattern i need to type
thanks (3 Replies)
Hi there,
Not being too up on bash shell programming at this point, could anyone throw me a bone about how to zip up a set of numerically-named files by range?
For example, in a folder that contains files 1.pdf through 132000.pdf, I'd like to zip up just those files that are 50000.pdf and... (6 Replies)
I am trying to use awk to match the NM_ in file with $1 of id which is tab-delimited. The NM_ will always be in the line of file that starts with > and be after the second _. When there is a match between each NM_ and id, then the value of $2 in id is substituted or used to update the NM_. Each NM_... (3 Replies)
Input: START
OS:: UNIX
Release: xxx
Version: xxx
END
START
OS:: LINUX
Release: xxx
Version: xxx
END
START
OS:: Windows
Release: xxx
Version: xxx
ENDHere i am trying to get all the information between START and END, only if i could match OS Type.
I can get all the data between the... (3 Replies)
In the awk below I am trying to match the value in $4 of file1 with the split value from $4 in file2. I store the value of $4 in file1 in A and the split value (using the _ for the split) in array. I then strore the value in $2 as min, the value in $3 as max, and the value in $1 as chr.
If A is... (6 Replies)
I all
I am tryng to find a way to sort a list of number in a file by the value of last two digit.
i have a list like this
313202320388
333202171199
373202164587
393202143736
323202132208
353201918107
343201887399
363201810249
333201805043
353201791691 (7 Replies)
Discussion started by: rattoeur
7 Replies
LEARN ABOUT OSX
digittoint_l
DIGITTOINT(3) BSD Library Functions Manual DIGITTOINT(3)NAME
digittoint, digittoint_l -- convert a numeric character to its integer value
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <ctype.h>
int
digittoint(int c);
#include <xlocale.h>
#include <ctype.h>
int
digittoint_l(int c, locale_t loc);
DESCRIPTION
The digittoint() function converts a numeric character to its corresponding integer value. The character can be any decimal digit or hexa-
decimal digit. With hexadecimal characters, the case of the values does not matter.
While the digittoint() function uses the current locale, the digittoint_l() function may be passed a locale directly. See xlocale(3) for more
information.
RETURN VALUES
The digittoint() function always returns an integer from the range of 0 to 15. If the given character was not a digit as defined by
isxdigit(3), the function will return 0.
SEE ALSO ctype(3), isdigit(3), isxdigit(3), xlocale(3)BSD April 6, 2001 BSD