Sponsored Content
Full Discussion: Get IP list from CIDR
Top Forums Shell Programming and Scripting Get IP list from CIDR Post 302102222 by anbu23 on Tuesday 9th of January 2007 05:55:39 AM
Old 01-09-2007
Code:
ip=$( echo $1 | cut -d"/" -f1 )
no=$( echo $1 | cut -d"/" -f2 )
num=1
new_ip=$( echo $ip | cut -d"." -f1-3 )

while [[ $num -ne $no ]]
do
	echo $new_ip".$num"
	(( num = num + 1 ))
done

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

send email from address list and subject list

Hello, Here is my problem. there are two files. first.txt <<< contains email address ====== abc@mail.com abd@mail.com abe@mail.com second.txt <<< contains webpage links ======== http//www.test.com/abc/index.html http://www.test.com/abd/index.html http://www.test.com/abe/index.html... (2 Replies)
Discussion started by: paulds
2 Replies

2. UNIX for Dummies Questions & Answers

counting a list of string in a list of txt files

Hi there! I have 150 txt files named chunk1, chunk2, ........., chunk150. I have a second file called string.txt with more than 1000 unique strings, house, dog, cat ... I want to know which command I should use to count how many times each string appears in the 150 files. I have tried... (4 Replies)
Discussion started by: Pep Puigvert
4 Replies

3. Shell Programming and Scripting

Splitting a list @list by space delimiter so i can access it by using $list[0 ..1..2]

EDIT : This is for perl @data2 = grep(/$data/, @list_now); This gives me @data2 as Printing data2 11 testzone1 running /zones/testzone1 ***-*****-****-*****-***** native shared But I really cant access data2 by its individual elements. $data2 is the entire list, while $data,2,3...... (1 Reply)
Discussion started by: shriyer
1 Replies

4. Programming

How to parse IP range in CIDR format in C

Hello everybody, I'm coding a network program and i need it to "understand" ip ranges, but i don't know how to make to parse an IP CIDR range, let's say "172.16.10.0/24" to work with the specified IP range. I've found a program which does it, but i don't understand the code. Here is the... (3 Replies)
Discussion started by: semash!
3 Replies

5. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

6. UNIX for Dummies Questions & Answers

Creating a column based list from a string list

I have a string containing fields separated by space Example set sr="Fred Ted Joe Peter Paul Jean Chris Tim Tex" and want to display it in a column format, for example to a maximum of a window of 100 characters And hopefully display some thing like Fred Ted Joe ... (3 Replies)
Discussion started by: kristinu
3 Replies

7. Shell Programming and Scripting

How to change ip addressing format from CIDR notation to netmask and vice versa?

Hi all, I would appreciate if someone could share how to convert CIDR notation to netmask and vice versa. The value below is just an example. it could be different numbers/ip addresses. Initial Output, let say file1.txt Final Output, let say file2.txt (3 Replies)
Discussion started by: type8code0
3 Replies

8. Shell Programming and Scripting

Convert ip ranges to CIDR netblocks

Hi, Recently I had to convert a 280K lines of ip ranges to the CIDR notation and generate a file to be used by ipset (netfilter) for ip filtering. Input file: 000.000.000.000 - 000.255.255.255 , 000 , invalid ip 001.000.064.000 - 001.000.127.255 , 000 , XXXXX 001.000.245.123 -... (10 Replies)
Discussion started by: ripat
10 Replies

9. Shell Programming and Scripting

Convert ip ranges to CIDR netblock

2 scripts to convert IP ranges to CIDR notation using awk, gawk or mawk. The scripts are much faster than using ipcalc and will return the same results. The first script is reliably compatible with awk, gawk and mawk but is over 3 times as slow as the second script which is reliably compatible with... (38 Replies)
Discussion started by: azdps
38 Replies
NUMFMT_PARSE_CURRENCY(3)						 1						  NUMFMT_PARSE_CURRENCY(3)

NumberFormatter::parseCurrency - Parse a currency number

	Object oriented style

SYNOPSIS
public float NumberFormatter::parseCurrency (string $value, string &$currency, [int &$position]) DESCRIPTION
Procedural style float numfmt_parse_currency (NumberFormatter $fmt, string $value, string &$currency, [int &$position]) Parse a string into a double and a currency using the current formatter. PARAMETERS
o $fmt -NumberFormatter object. o $currency - Parameter to receive the currency name (3-letter ISO 4217 currency code). o $position - Offset in the string at which to begin parsing. On return, this value will hold the offset at which parsing ended. RETURN VALUES
The parsed numeric value or FALSE on error. EXAMPLES
Example #1 numfmt_parse_currency(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY ); $num = "1.234.567,89xc2xa0$"; echo "We have ".numfmt_parse_currency($fmt, $num, $curr)." in $curr "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::CURRENCY ); $num = "1.234.567,89xc2xa0$"; echo "We have ".$fmt->parseCurrency($num, $curr)." in $curr "; ?> The above example will output: We have 1234567.89 in USD SEE ALSO
numfmt_get_error_code(3), numfmt_parse(3), numfmt_format_currency(3). PHP Documentation Group NUMFMT_PARSE_CURRENCY(3)
All times are GMT -4. The time now is 11:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy