Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using a case statement with a range of numbers Post 302373452 by fufaso on Friday 20th of November 2009 08:56:34 AM
Old 11-20-2009
Using a case statement with a range of numbers

Hey guys,

I'm trying to setup a case statement that checks a value against 5 separate ranges of numbers.

Here are the things I've tried with no success.

Code:
case "$AGE" in
        "<10") echo "You're in this decade.";;
        "[11..20]") echo "You're in this decade.";;
        "[21,30]") echo "You're in this decade.";;
        "[31-40]") echo "You're in this decade.";;
        "[>41&&<50]) echo "You're in this decade.";;
        
esac

Anyone have any ideas as to set this up?

Last edited by rbatte1; 09-16-2016 at 08:14 AM.. Reason: Added CODE tags
 

10 More Discussions You Might Find Interesting

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

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

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

4. UNIX Desktop Questions & Answers

Specifying a range within case/esac

Complete Unix beginner here. I basically have this script - This seems to work fine. I want to try and shorten it by making it something like this - This isn't working. I think it's probably to do with the zero padding that `date +%H` gives me, but if I use `date +%k`, I get a space at... (3 Replies)
Discussion started by: Orbient
3 Replies

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

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

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

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

9. Shell Programming and Scripting

Match on a range of numbers

Hi, I'm trying to match a filename that could be called anything from vout001 to vout252 and was trying to do a small test but I'm not getting the result I thought I would.. Can some one tell me what I'm doing wrong? *****@********>echo $mynumber ... (4 Replies)
Discussion started by: Jazmania
4 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
AGE(4)							   BSD Kernel Interfaces Manual 						    AGE(4)

NAME
age -- Attansic L1 10/100/Gigabit Ethernet device SYNOPSIS
age* at pci? atphy* at mii? DESCRIPTION
The age driver provides support for Ethernet interfaces based on the Attansic L1 Ethernet chipset. The age driver supports IPv4 receive IP/TCP/UDP checksum offload and VLAN tag insertion and stripping. The following media types are supported: autoselect Enable autoselection of the media type and options. 10baseT Set 10Mbps operation. 100baseTX Set 100Mbps (Fast Ethernet) operation. 1000baseT Set 1000Mbps (Gigabit Ethernet) operation. For more information on configuring this device, see ifconfig(8). To view a list of media types and options supported by the card, try ifconfig <device> media. For example, ifconfig age0 media. SEE ALSO
arp(4), atphy(4), ifmedia(4), intro(4), netintro(4), pci(4), ifconfig(8) HISTORY
The age device driver first appeared in OpenBSD 4.5. It was then ported to NetBSD 5.1. AUTHORS
The age driver was written by Pyun YongHyeon for FreeBSD, ported to OpenBSD by Kevin Lo <kevlo@OpenBSD.org> then ported to NetBSD by Christoph Egger <cegger@NetBSD.org>. BSD
May 5, 2009 BSD
All times are GMT -4. The time now is 01:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy