Sponsored Content
Full Discussion: IP-Scripting Issue
Top Forums Shell Programming and Scripting IP-Scripting Issue Post 302314478 by mraghunandanan on Friday 8th of May 2009 11:22:38 AM
Old 05-08-2009
IP-Scripting Issue

Hi Guys,

I am quite new to Shell Scripting... I need ur help.. This is very urgent.

The thing is like,
I need to match a IP address (ex 192.168.200.56) i.e, xxx.xxx.xxx.xx inside a KSH script,but if we enter in different format other than the specified format (ex jjj.ksj., 1.0...), it should throw an error.

Appreciate ur help...

Regards,

Mahesh Raghunandanan
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

scripting issue

folks; i'm trying to write a shell script to do the following: 1. i have a file with 39 fields, i'm trying to add 10 more fields with (!) as a field separator. with the following requirement: if field number 20 has a value, then field number 40 will show as (!M!), and if the field number 20 does... (2 Replies)
Discussion started by: moe2266
2 Replies

2. Shell Programming and Scripting

Scripting issue..

Hi guys... I am a newbie to scripting... I have a small requirement... I dont whether u r clear with my requirement... But plz try to help me... Like, tell me some kind of scripts that can help me in retreiving the data from the datasets. Regards, Mahesh... (1 Reply)
Discussion started by: mraghunandanan
1 Replies

3. Shell Programming and Scripting

Scripting issue..

Hi guys... I am newbie to Shell Scripting... I am querying the Oracle database.I want a Shell script for fetching some data from datasets in Oracle database and displaying in an excel sheet.This is my requirement.. Can u plz help me guys.. Regards, Mahesh... (4 Replies)
Discussion started by: mraghunandanan
4 Replies

4. Shell Programming and Scripting

scripting issue

Hello, Guys I am having a sql script file which contains some sql statements including inserting values, One column is of the data type date. Now i am having a KSH script for inserting values via this script into the database. The problem I am facing that when I am inserting value in the... (1 Reply)
Discussion started by: mraghunandanan
1 Replies

5. Shell Programming and Scripting

Scripting issue

Hello, I have an ASCII file (many files of the same format, but different dates and numbers) in the format like below: 2008.01.02,08:00,1.46520,1.46520,1.46410,1.46440,70 2008.01.02,08:05,1.46450,1.46560,1.46440,1.46540,79 2008.01.02,08:10,1.46530,1.46540,1.46490,1.46500,46... (8 Replies)
Discussion started by: chief2000
8 Replies

6. Shell Programming and Scripting

Scripting Issue

I am having an issue with a script that I created today, my first attempt at this, and was wondering if anyone can give me insight to what changes need to be made. Below is a copy of the script that I have written. WEe are trying to monitor whether or not a services is running. I do have a cron... (1 Reply)
Discussion started by: lsudubee
1 Replies

7. Shell Programming and Scripting

Scripting Issue

needing this script to shut down 1 IceS and start up another, close the 2nd one after 12 seconds and then reboot. here is what i have so far #!/bin/bash ShutDown() { echo "Shutdown in progress." wall <<ENDOFWALL CI Shutdown has been intiated!!!! Shutdown will occur in 30 seconds...... (1 Reply)
Discussion started by: Zaine
1 Replies

8. Shell Programming and Scripting

Scripting issue

I am having a problem. which I have described below>> I have to run a script with the format : <File_name><Start_date><End_date> abcd.sh 19-JAN-2015 01-May-2014 problem is I need to compare these two dates and throw an error as start date must be less than or equal to end date. But... (13 Replies)
Discussion started by: Chandan_Bose
13 Replies

9. Shell Programming and Scripting

Scripting Issue

Hi All, I am facing a problem when i am trying to run shell script more than 5 times. I have shell script(.sh file) which ran perfectly fine in the early attempts(1,2,3,4 runs). But if i try to run the script more number of times, i am facing the below error message. Too many ('s I do... (3 Replies)
Discussion started by: am24
3 Replies

10. Shell Programming and Scripting

Scripting issue

Hi Experts, I'm stuck with a single liner bash script. Need your help to fix it. Let me brief you that what is my expectations from this script. I need the interfaces configured for a list of servers, their respective IP address and FQDN in a output file. The output should be in the same... (3 Replies)
Discussion started by: arun_adm
3 Replies
Geo::IPfree(3pm)					User Contributed Perl Documentation					  Geo::IPfree(3pm)

NAME
Geo::IPfree - Look up the country of an IPv4 address SYNOPSIS
use Geo::IPfree; my $geo = Geo::IPfree->new; my( $code1, $name1 ) = $geo->LookUp( '200.176.3.142' ); # use memory to speed things up $geo->Faster; # lookup by hostname my( $code2, $name2, $ip2 ) = $geo->LookUp( 'www.cnn.com' ); DESCRIPTION
Geo::IPfree is a Perl module that determines the originating country of an arbitrary IPv4 address. It uses a local file-based database to provide basic geolocation services. An updated version of the database can be obtained by visiting the Webnet77 website: http://software77.net/geo-ip/ <http://software77.net/geo-ip/>. METHODS
new( [$db] ) Creates a new Geo::IPfree instance. Optionally, a database filename may be passed in to load a custom data set rather than the version shipped with the module. LoadDB( $filename ) Load a specific database to use to look up the IP addresses. LookUp( $ip | $hostname ) Given an IP address or a hostname, this function returns three things: o The ISO 3166 country code (2 chars) o The country name o The IP address resolved NB: In order to use the location services on a hostname, you will need to have an internet connection to resolve a host to an IP address. If you pass a private IP address (for example 192.168.0.1), you'll get back a country code of ZZ, and country name of "Reserved for private IP addresses". Clean_Cache( ) Clears any cached lookup data. Faster( ) Make the LookUp() faster, which is good if you're going to be calling Lookup() many times. This will load the entire DB into memory and read from there, not from disk (good way for slow disk or network disks), but use more memory. The module "Memoize" will be enabled for some internal functions too. Note that if you call Lookup() many times, you'll end up using a lot of memory anyway, so you'll be better off using a lot of memory from the start by calling Faster(), and getting an improvement for all calls. nslookup( $host, [$last_lookup] ) Attempts to resolve a hostname to an IP address. If it fails on the first pass it will attempt to resolve the same hostname with 'www.' prepended. $last_lookup is used to supress this behavior. ip2nb( $ip ) Encodes $ip into a numerical representation. nb2ip( $number ) Decodes $number back to an IP address. dec2baseX( $number ) Converts a base 10 (decimal) number to base 86. baseX2dec( $number ) Converts a base 86 number to base 10 (decimal). VARS
$GeoIP->{db} The database file in use. $GeoIP->{handler} The database file handler. $GeoIP->{dbfile} The database file path. $GeoIP->{cache} BOOLEAN Set/tell if the cache of LookUp() is on. If it's on it will cache the last 1000 queries. Default: 1 The cache is good when you are parsing a list of IPs, generally a web log. If in the log you have many lines with the same IP, GEO::IPfree won't have to make a full search for each query, it will cache the last 1000 different IPs. After each 1000 IPs the cache is cleaned to restart it. Note that the Lookup make the query without the last IP number (xxx.xxx.xxx.0), then the cache for the IP 192.168.0.1 will be the same for 192.168.0.2 (they are the same query, 192.168.0.0). DB FORMAT
The data file has a list of IP ranges & countries, for example, from 200.128.0.0 to 200.103.255.255 the IPs are from BR. To make a fast access to the DB the format tries to use less bytes per input (block). The file was in ASCII and in blocks of 7 bytes: XXnnnnn XX -> the country code (BR,US...) nnnnn -> the IP range using a base of 85 digits (not in dec or hex to get space). See CPAN for updates of the DB... NOTES
The file ipscountry.dat is a dedicated format for Geo::IPfree. To convert it see the tool "ipct2txt.pl" in the "misc" directoy. The module looks for "ipscountry.dat" in the following locations: o /usr/local/share o /usr/local/share/GeoIPfree o through @INC (as well as all @INC directories plus "/Geo") o from the same location that IPfree.pm was loaded SEE ALSO
o http://software77.net/geo-ip/ AUTHOR
Graciliano M. P. <gm@virtuasites.com.br> MAINTAINER
Brian Cassidy <bricas@cpan.org> THANK YOU
Thanks to Laurent Destailleur (author of AWStats) that tested it on many OS and fixed bugs for them, like the not portable sysread, and asked for some speed improvement. COPYRIGHT &; LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-14 Geo::IPfree(3pm)
All times are GMT -4. The time now is 06:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy