HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regex tips
Operating System - HP-UX
1826489
Members
4233
Online
109692
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
01-28-2010 06:19 AM
01-28-2010 06:19 AM
Dear,
I have this regular expression wich works fine on linux with sed 4.1.5 :
# echo "bla: 567/1234" | sed -n -e "s_.*\s\([0-9]*\)/\([0-9][0-9][0-9][0-9]\).*_\1_p"
567
Now, i try this on HP-UX 11iv1 but it return nothing...
I also try with :
echo "bla: 567/1234" | sed -n -e "s_.*\[:space:]\([0-9]*\)/\([0-9][0-9][0-9][0-9]\).*_\1_p"
i suspect \s doesn't work with this version of sed (sed --version doesn't works on HP..)
Any help would be appreciate
I have this regular expression wich works fine on linux with sed 4.1.5 :
# echo "bla: 567/1234" | sed -n -e "s_.*\s\([0-9]*\)/\([0-9][0-9][0-9][0-9]\).*_\1_p"
567
Now, i try this on HP-UX 11iv1 but it return nothing...
I also try with :
echo "bla: 567/1234" | sed -n -e "s_.*\[:space:]\([0-9]*\)/\([0-9][0-9][0-9][0-9]\).*_\1_p"
i suspect \s doesn't work with this version of sed (sed --version doesn't works on HP..)
Any help would be appreciate
Solved! Go to Solution.
- Tags:
- regex
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2010 06:37 AM
01-28-2010 06:37 AM
Solution
Hi:
First, HP's 'sed' lacks the power of the GNU 'sed'. Even things like '\s' for whitespace are missing.
In lieu of using:
\s*
...you can use:
[[:space:]]*
Notice the double brackets where you only used single ones.
Hence, this works on HP-UX:
# echo "bla: 567/1234" | sed -n -e "s_.*[[:space:]]\([0-9]*\)/\([0-9][0-9][0-9][0-9]\).*_\1_p"
567
Regards!
...JRF...
First, HP's 'sed' lacks the power of the GNU 'sed'. Even things like '\s' for whitespace are missing.
In lieu of using:
\s*
...you can use:
[[:space:]]*
Notice the double brackets where you only used single ones.
Hence, this works on HP-UX:
# echo "bla: 567/1234" | sed -n -e "s_.*[[:space:]]\([0-9]*\)/\([0-9][0-9][0-9][0-9]\).*_\1_p"
567
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2010 06:52 AM
01-28-2010 06:52 AM
Re: Regex tips
Thanks
It's works (forget double bracket..) :
echo "bla: 567/1234" | sed -n -e "s_.*[[:space:]]\([0-9]*\)/\([0-9]*\).*_\1_p"
It's works (forget double bracket..) :
echo "bla: 567/1234" | sed -n -e "s_.*[[:space:]]\([0-9]*\)/\([0-9]*\).*_\1_p"
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP