- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regexp range
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2004 11:23 PM
12-20-2004 11:23 PM
Regards Petra
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2004 11:33 PM
12-20-2004 11:33 PM
Re: Regexp range
try something like this.
# grep "17[5-6][0-9][0-9]" file
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2004 11:46 PM
12-20-2004 11:46 PM
SolutionRobert-Jan,
The statement
grep "17[5-6][0-9][0-9]" file
will also include the numbers 17500-17584 and 17644-17699
thus they need to include grep -v 's
# grep "17[5-6][0-9][0-9]" file | grep -v -e "175[0-7][0-9]" -e "1758[0-4]" -e "1764[4-9]" -e "176[5-9][0-9]"
live free or die
harry d brown jr
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2004 11:47 PM
12-20-2004 11:47 PM
Re: Regexp range
for i in `cat file`
do
if [ "$i" -gt 17584 ]
then
if [ "$i" -lt 17644 ]
then
echo $i
fi
fi
done
HTH,
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2004 11:47 PM
12-20-2004 11:47 PM
Re: Regexp range
Petra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 12:11 AM
12-21-2004 12:11 AM
Re: Regexp range
[root@vpart1 /tmp]# cat xyz
17499
17500
17540
17580
17584
17585
17586
17600
17640
17642
17643
17644
17650
17800
[root@vpart1 /tmp]# grep "17[5-6][0-9][0-9]" xyz | grep -v -e "175[0-7][0-9]" -e "1758[0-4]" -e "1764[4-9]" -e "176[5-9][0-9]"
17585
17586
17600
17640
17642
17643
[root@vpart1 /tmp]#
live free or die
harry d brown jr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 12:13 AM
12-21-2004 12:13 AM
Re: Regexp range
Check Harry's second option, he allready added the grep -v options to remove the ranges.
Robert-Jan
Ps
Thanks Harry for the correction.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 12:21 AM
12-21-2004 12:21 AM
Re: Regexp range
Regards Petra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2004 12:45 AM
12-21-2004 12:45 AM
Re: Regexp range
# echo "17485" | perl -nle'/\b(17\d\d\d)\b(??{$x=$^N>=17585&&$^N<=17643?"":"(?<=X)"})\b/ and print "IN"'
# echo "17585" | perl -nle'/\b(17\d\d\d)\b(??{$x=$^N>=17585&&$^N<=17643?"":"(?<=X)"})\b/ and print "IN"'
IN
OK, that's dirty!
# echo "17585" | perl -nle'/\b17(5(8[5-9]|[6-9]\d)|6([0-3]\d|4[0-3]))\b/ and print "Match!"
Enjoy, Have FUN! H.Merijn