Sponsored Content
Full Discussion: Match on a range of numbers
Top Forums Shell Programming and Scripting Match on a range of numbers Post 302879246 by Corona688 on Wednesday 11th of December 2013 11:49:00 AM
Old 12-11-2013
There are several different kinds of confusion in there.

You cannot use == inside [ ] brackets, it needs [[ ]] brackets.

And == does not understand number ranges anyway. It understands characters.

Try a case statement:

Code:
case "$VAR" in
abcd[0-9])  echo stuff ;;
abcd[1-9][0-9])  echo stuff ;;
abcd1[0-9][0-9]) echo stuff ;;
abcd2[1-4][0-9]) echo stuff ;;
abcd25[0-2]) echo stuff ;;
*) echo "not matched" ;;
esac

Or you could try stripping out the number first and just comparing that.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep numbers range

I want to grep a range of numbers in a log file. My log file looks like this: 20050807070609Z;blah blah That is a combination of yr,month,date,hours,minutes,seconds. I want to search in the log file events that happened between a particular time. like between 20050807070000 to 20050822070000... (1 Reply)
Discussion started by: azmathshaikh
1 Replies

2. UNIX for Dummies Questions & Answers

Using grep on a range of numbers

Hi im new to unix and need to find a way to grep the top 5 numbers in a file and put them into another file. For example my file looks like this abcdef 50000 abcdef 45000 abcdef 40000 abcdef 35000 abcdef 30000 abcdef 25000 abcdef 20000 abcdef 15000 abcdef 10000 and so on... How can... (1 Reply)
Discussion started by: ProgChick2oo9
1 Replies

3. Shell Programming and Scripting

read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ... (6 Replies)
Discussion started by: thepurple
6 Replies

4. Shell Programming and Scripting

match range of different numbers by AWK

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)
Discussion started by: repinementer
54 Replies

5. UNIX for Dummies Questions & Answers

List-to-Range of Numbers

Hello, I have two columns with data that look like this: Col1 Col2 ------ ----- a 1 a 2 a 3 a 4 a 7 a 8 a 9 a 10 a 11 b 6 b 7 b 8 b 9 b 14 (5 Replies)
Discussion started by: Gussifinknottle
5 Replies

6. UNIX for Dummies Questions & Answers

Frequency of a range of numbers

Hello, I have a column where there are values from 1 to 150. I want to get the frequency of values in the following ranges: 1-5 6-10 11-15 .... .... .... 146-150 How can I do this in a for loop? Thanks, Guss (1 Reply)
Discussion started by: Gussifinknottle
1 Replies

7. UNIX for Dummies Questions & Answers

How to count how many numbers in a certain range?

Hi I have a data file with two columns which looks like: 1 42 2 40 3 55 4 50 5 38 6 49 7 33 8 46 9 39 10 33 11 33 12 26 13 46 14 44 15 55 16 54 17 30 18 32 (7 Replies)
Discussion started by: marhuu
7 Replies

8. Shell Programming and Scripting

grep for a range of numbers

Dear Friends, I want to know how to grep for the lines that has a number between given range(start and end). I have tried the following sed command. sed -n -e '/20030101011442/,/20030101035519/p' However this requires both start and end to be part of the content being grepped. However... (4 Replies)
Discussion started by: tamil.pamaran
4 Replies

9. UNIX for Dummies Questions & Answers

Grep for a range of numbers?

I am trying to extract specific information from a large *.sam file (it's originally 28Gb). I want to extract all lines that are on chr3 somewhere in the range of 112,937,439-113,437,438. Here is a sample line from my file so you can get a feel for what each line looks like: seq.4 0 ... (8 Replies)
Discussion started by: genGirl23
8 Replies

10. Shell Programming and Scripting

Print range of numbers

Hi I am getting an argument which specifies the range of numbers. eg: 7-15 Is there a way that i can easily (avoiding loop) print the range of number between and including the specified above. The above example should translate to 7,8,9,10,11,12,13,14,15 (3 Replies)
Discussion started by: tostay2003
3 Replies
Bio::Tools::Match(3pm)					User Contributed Perl Documentation				    Bio::Tools::Match(3pm)

NAME
Bio::Tools::Match - Parses output from Transfac's match(TM) SYNOPSIS
use strict; use Bio::Tools::Match; my $parser = Bio::Tools::Match->new(-file => "match.out"); while (my $feat = $parser->next_result) { my $start = $feat->start; my $end = $feat->end; my $core_score = $feat->score; my $matrix_score = ($feat->annotation->get_Annotations('matrix_score'))[0]->value; my $matrix_id = ($feat->annotation->get_Annotations('matrix_id'))[0]->value; } DESCRIPTION
This module is used to parse the output from Transfac's match(TM) program. It doesn't support the histogram output of match. Each result is a Bio::SeqFeature::Annotated representing a single matrix match. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Sendu Bala Email bix@sendu.me.uk APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::Tools::Match->new(); Function: Builds a new Bio::Tools::Match object Returns : Bio::Tools::Match Args : -file (or -fh) should contain the contents of a standard match output next_result Title : next_result Usage : $result = $obj->next_result(); Function: Returns the next result available from the input, or undef if there are no more results. Returns : Bio::SeqFeature::Annotated object. Features are annotated with tags for 'matrix_score', 'matrix_id' and a 'predicted' tag. Args : none perl v5.14.2 2012-03-02 Bio::Tools::Match(3pm)
All times are GMT -4. The time now is 02:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy