![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| validating data | joanneho | Shell Programming and Scripting | 1 | 10-08-2006 09:03 AM |
| Validating date in sas | radhika03 | Shell Programming and Scripting | 1 | 09-16-2005 02:33 AM |
| Validating $1 and $2 before using | nhatch | Shell Programming and Scripting | 6 | 09-17-2003 10:01 AM |
| validating input | ruffenator | High Level Programming | 4 | 04-24-2002 05:30 AM |
| validating dates | MizzGail | Shell Programming and Scripting | 2 | 03-05-2002 01:34 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
HELP: validating IP addresses any way possible
-------------------------------------------------------------------------------- I am trying to validate input from the user in a script. I thought is was easy to do using regular expressions but I can't figure out how to use REs in a conditional. I have tried using grep from a temp file, sed from a temp file, sed from command line, comparison in an if condition and I cannot figure it out and I don't have much hair left! i am trying to validate input of an IP address. Thanks for your help OK I have tried the following expressions that according to the regex tool match IP addresses, but they all seem to flip flop back and forth for valid and not valid IPs and the entire list albeit 2 or 3 are valid. What is the deal. I would gladly do this another way if anyone could steer me in the right direction. Thanks greatly for your help!! rc=`egrep -c "[0-9][13]\.[0-9][13]\.[0-9][13]\.[0-9][13]"` rc=`egrep -c \\b\(?:\(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\ \.\){3}\(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\\b"` rc=`egrep -c '\\b\(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\\.\(2 5[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\\.\(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\\.\(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\\b' rc=`egrep -c '10.\([781]|70|80\).\(25[0-5]|2[0-4][0-9]|[01]?[0- 9][0-9]?\)\\.\(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\)\\b' |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Moderator,
Please close this thread, the same user posted the same question yesterday in shell programming section and I have replied for that... without checking or replying to that he posted again here.... not following the rules by duplicating the messages. It is waste of time replying to this kind of users anymore... Thanks..Mahendra. |
|||
| Google The UNIX and Linux Forums |
| Tags |
| regex, regular expressions |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|