The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sed Range Issue Wrathe Shell Programming and Scripting 2 06-17-2008 04:54 PM
Copying specific files from remote m/c to specific folders jhoomsharabi Shell Programming and Scripting 0 06-12-2008 08:31 AM
specifing range.... zedex UNIX for Advanced & Expert Users 1 10-19-2007 10:07 AM
Look a string within a range! azmathshaikh Shell Programming and Scripting 0 05-01-2005 04:54 AM
Unix SCO 5.0.6 Out of range josramon UNIX for Dummies Questions & Answers 5 02-21-2003 02:06 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-16-2008
sylaan sylaan is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 14
Match a specific IP range

Hello all,

I would like a bit of help with a problem I am having. I have the following example file:

$ cat test_hosts
10.10.2.3 host1
10.10.2.4 host2
10.10.2.130 host3
10.10.2.5 host4
10.10.2.230 host5
10.10.2.22 host6

I need to match all IP addresses in the 10.10.2.1-10.10.2.22 range. I have tried all kind of things but for the life of me, I can't get it to work.

$ cat test_hosts | egrep "10\.10\.2\.[1,22]\s"

This shows nothing.

$ cat test_hosts | egrep "10\.10\.2\.[1,22]"
10.10.2.130 host3
10.10.2.230 host5
10.10.2.22 host6

Not exactly what I need. What am I doing wrong ?


Thanks,
Sylaan
 

Bookmarks

Tags
regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:49 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0