- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- exact match
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
Discussions
Discussions
Forums
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
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-07-2008 09:53 PM
тАО12-07-2008 09:53 PM
I'm so tired to even think so can you please advice how can I get the exact string without getting the other similar one?
Get 10 easy points!
# mount|awk '/vghp17uv/'
/uvtmp on /dev/vghp17uvtmp/lvol1 ioerror=mwdisable,largefiles,delaylog,dev=40040001 on Sun Nov 16 01:08:38 2008
/u1 on /dev/vghp17uv/lvol1 ioerror=mwdisable,largefiles,delaylog,dev=40020001 on Sun Nov 16 01:08:39 2008
Here is the problem. It's not getting the right one?
# mount|awk '/vghp17uv/ {print $1}'|cut -d / -f 2
uvtmp
u1
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2008 11:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2008 11:52 PM
тАО12-07-2008 11:52 PM
Re: exact match
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-08-2008 05:13 AM
тАО12-08-2008 05:13 AM
Re: exact match
in PERL the Regular expressions have this nice \b to match on a word boundary.
The solution then becomes...
mount | perl -ne 'print $1 if /^.(\w+)\s.*\bvghp17uv\b/'
fwiw,
Hein.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-08-2008 05:22 AM
тАО12-08-2008 05:22 AM
Re: exact match
You could also use Perl which allows a variety of delimiters for regular expressions and makes using the '/' character simple to visualize.
# mount|perl -nale 'print $F[0] if $F[2]=~m{/vghp17uv/}'
/u1
This also avoids having to worry about the length of fields. Notice that Perl numbers the first field as zero whereas 'awk' counts from one.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 07:57 AM
тАО12-09-2008 07:57 AM
Re: exact match
mount | egrep "/vghp17uv/" | cut -d'/' -f2
this should work better (since egrep doesn't bother with that // to specify a search) and give you a more exact match.
Best regards
Fredrik Eriksson
- Tags:
- regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 02:23 PM
тАО12-09-2008 02:23 PM
Re: exact match
There is no reason to use the egrep hammer, fgrep/grep is fine. You can also use grep -w and leave out the "/".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2008 12:17 AM
тАО12-10-2008 12:17 AM
Re: exact match
grep would do it fine since no regexp is involved :P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-27-2009 10:09 AM
тАО01-27-2009 10:09 AM