Sponsored Content
Top Forums Programming Perl : Numeric Range Pattern Matching Post 302539402 by doubando on Sunday 17th of July 2011 07:44:41 AM
Old 07-17-2011
Java Perl : Numeric Range Pattern Matching

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 ) =~ /[1-254].[1-254].[1-254].[1-254]/
{

}


what the pattern i need to type


thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl pattern matching

hi i am trying to get digits inside brackes from file , whose structure is defined below CREATE TABLE TELM (SOC_NO CHAR (3) NOT NULL, TXN_AMOUNT NUMBER (17,3) SIGN_ON_TIME CHAR (8) TELLER_APP_LIMIT NUMBER (17,3) FIL01 ... (2 Replies)
Discussion started by: zedex
2 Replies

2. Shell Programming and Scripting

Perl Pattern Matching !!! Help

Hello I got the below one from in one of this forums For Ex: Loading File System Networking in nature now i need to extract the patterns between the words File and Networking : i.e. sample output: System cmd used : cat <file> | sed 's/.*File //' | sed 's/Closing.*$//' Actually... (0 Replies)
Discussion started by: maxmave
0 Replies

3. Shell Programming and Scripting

Perl -Pattern Matching help..!

Hi, I got doubt in Pattern matching, could you tell me how the following differs in action ?? if ( $line1==/$line2/ ) if ( $line1=~/$line2/ ) if ( $line1=~m/$line2/) What is the significance of '~' in matching. Thanks in advance CoolBhai (5 Replies)
Discussion started by: coolbhai
5 Replies

4. Shell Programming and Scripting

Perl pattern matching!!

Hi experts, I have many occurances of the following headers in a file. I need to grep for the word changed/inserted in the header, calculate the difference between the two numbers and list the count incrementally. Headers in a file look like this: ------------------- ---------------------... (6 Replies)
Discussion started by: nmattam
6 Replies

5. Shell Programming and Scripting

Perl Pattern matching...

I am doing a file patterhn matching for a text file in PERL I am using this,,, but it says that no file is found $filepattern = '\d{1,4}.*A0NW9693.NDM.HBIDT.*.AD34XADJ.txt'; Can anyone help me out with Perl Pattern Matching concepts and how to do pattern matching for this txt file:... (4 Replies)
Discussion started by: msrahman
4 Replies

6. Shell Programming and Scripting

Pattern Matching in PERL

I have a 2 files in .gz format and it consists of 5 million lines the format of the file would be gzcat file1.gz | more abcde aerere ffgh56 .. .. 12345 gzcat file2.gz | more abcde , 12345 , 67890, ffgh56 , 45623 ,12334 whatever the string is in the file1 should be matched... (3 Replies)
Discussion started by: aravindj80
3 Replies

7. Shell Programming and Scripting

print range of lines matching pattern and previous line

Hi all, on Solaris 10, I'd like to print a range of lines starting at pattern but also including the very first line before pattern. the following doesn't print the range starting at pattern and going down to the end of file: cat <my file> | sed -n -e '/<pattern>{x;p;}/' I need to include the... (1 Reply)
Discussion started by: siriche
1 Replies

8. Shell Programming and Scripting

Need help with perl pattern matching

My log file looks as given below, its actually a huge file around 1 GB and these are some of the line: conn=5368758 op=10628050 msgId=64 - RESULT err=0 tag=101 nentries=1 etime=0 conn=7462122 op=-1 msgId=-1 - fd=247 slot=247 LDAPS connection from 10.13.18.12:37645 to 10.18.6.45 conn=7462122... (5 Replies)
Discussion started by: sags007_99
5 Replies

9. Shell Programming and Scripting

Pattern matching in Perl

Hi, I have a list of IP, eg : 192.168.0.15 192.168.0.24 192.168.2.110 192.168.2.200 And I would like the shortest pattern who match with '192.168.0' and '192.168.2' (without the last dot and number). (7 Replies)
Discussion started by: X-Or
7 Replies

10. Shell Programming and Scripting

Extract range from config file matching pattern

I have config file like this: server_name xx opt1 opt2 opt3 suboptions1 #suboptions - disabled suboptions2 pattern suboptions3 server_name yy opt1 opt2 opt3 suboptions1 pattern #suboptions - disabled suboptions2 So basically I want to extract the server... (1 Reply)
Discussion started by: nemesis911
1 Replies
SOCKD.ROUTE(5)							File Formats Manual						    SOCKD.ROUTE(5)

NAME
sockd.route - Route file for multi-homed SOCKS proxy server SYNOPSIS
/etc/sockd.route DESCRIPTION
The file /etc/sockd.route is used by the SOCKS server program sockd to determine which of its network interfaces it should use to reach a given destination host. It is needed only if your SOCKS server host is multi-homed and your version of sockd supports RBIND. A multi-homed host is a host with more than one network interfaces and with its IP_FORWARDING turned off. Only the multi-homed version of sockd can be run on such hosts. You can find out the version of your sockd (or rsockd) by command sockd -ver or rsockd -ver A line in the file can be up to 1024 characters long. Lines starting with a `#' are comments. Non-comment lines must be of the form if_addr dst_addr dst_mask All three fields are required and are separated by spaces or tabs. Each filed is specified in the usual dotted form of IP addresses, e.g., 128.23.16.2. if_addr must be the IP address of one of the network interfaces on the SOCKS server host. dst_addr specifies either the IP address of a host, a network, or a subnet in the usual dotted form, e.g., 129.201.4.0, or a domain name, e.g., internic.net. dst_mask spec- ifies mask for the IP address used in dst_addr. Bits in dst_mask that are set to 0 indicate the bit positions to be ignored during compar- ison of IP addresses. So, specifying 255.255.255.255 in dst_mask demands an exact match with dst_addr, whereas 0.0.0.0 in dst_mask causes a matching with any given destination address regardless of what is specified for dst_addr. If a domain name is used for dst_addr, the con- tents of dst_mask are ignored, though it must still be supplied (simply use 0.0.0.0). If the domain name starts with a period, it speci- fies a zone and matches all domain names within that zone, otherwise it matches only the domain name itself. For example, xyz.com matches only xyz.comP, while .xyz.com macthes not only xyz.com, but also abc.xyz.com and this.and.that.xyz.com, among others. The special symbol ALL (which must be entirely in uppercase) matches everything. Domain names are otherwise case-insentive. When using a domain name in dst_addr, you have be very careful in maintaining your DNS setup. See the last few paragraphs in sockd.conf(5). When a multi-homed sockd receives a network request, it first checks with /etc/sockd.fc (or /etc/sockd.conf) to decide whether the request should be allowed or denied. For an allowable request, sockd then checks the given destination IP address or domain name against the dst_addr dst_mask pair in /etc/sockd.route, one line at a line. Once a match is found, the network interface of the corresponding if_addr field is used for connection to the destination host. Remaining lines in the file are skipped. Therefore the order of the lines in the file is of extreme importance. If no match is found throughout the file, a line indicating the error is produced using syslog with facility daemon and level err and the request is ignored. You have the option of using the frozen route file /etc/sockd.fr instead of /etc/sockd.route. The frosen file is produced by make_sockdfr and is essentially the memory image of the parsed route file. Using it can reduce the start-up delay of the SOCKS server since it eliminate the need for parsing. Since the SOCKS server always looks for /etc/sockd.fr first, be sure that you always run make_sockdfr every time after you modifify /etc/sockd.route. EXAMPLES
Suppose you have a dual-homed host with interface 129.1.2.3 connecting to your internal Class B network 129.1, and interface 129.1.254.1 connecting to the outside world. If you only use the SOCKS server to provide connections to outside hosts, then the file /etc/sockd.route only needs one line: 129.1.254.1 0.0.0.0 0.0.0.0 If you also use the SOCKS server to provide connection to internal hosts as well, then two lines would suffice: 129.1.2.3 129.1.0.0 255.255.0.0 129.1.254.1 0.0.0.0 0.0.0.0 Note that these two lines must be in the order given above. If you prefer using domain name instead, the lines should be 129.1.2.3 .myown.com 0.0.0.0 129.1.254.1 0.0.0.0 0.0.0.0 assuming that myown.com is your domain. SEE ALSO
dump_sockdfr(8), make_sockdfr(8), sockd(8), sockd.fr(5) May 6, 1996 SOCKD.ROUTE(5)
All times are GMT -4. The time now is 07:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy