- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grepping for whole words on HP10.20
Operating System - HP-UX
1753272
Members
5098
Online
108792
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
Discussions
Discussions
Forums
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
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
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
тАО12-01-2003 01:35 AM
тАО12-01-2003 01:35 AM
grepping for whole words on HP10.20
Is the inclusion of spaces in quotes the only way to grep for a whole word. I understand that the -w flag is not available within 10.20.
I have seen the use of \ in some examples, is this specific to any given platform or should this work in 10.20 and 11.00
TIA
I have seen the use of \
TIA
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 01:40 AM
тАО12-01-2003 01:40 AM
Re: grepping for whole words on HP10.20
you can try the -F option. From the man page:
In the Bourne shell (sh(1)) the following example searches two files,
finding all lines containing occurrences of any of four strings:
grep -F 'if
then
else
fi' file1 file2
mark
In the Bourne shell (sh(1)) the following example searches two files,
finding all lines containing occurrences of any of four strings:
grep -F 'if
then
else
fi' file1 file2
mark
the future will be a lot like now, only later
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 03:02 AM
тАО12-01-2003 03:02 AM
Re: grepping for whole words on HP10.20
Hi John,
there is still the problem, when the string is at the beginning or end of a line. Try the follwing command and see, if it suits you.
grep "search" file | grep -vE "[a-z,A-Z]search[a-z,A-Z]"
greetings,
Michael
there is still the problem, when the string is at the beginning or end of a line. Try the follwing command and see, if it suits you.
grep "search" file | grep -vE "[a-z,A-Z]search[a-z,A-Z]"
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-01-2003 11:02 AM
тАО12-01-2003 11:02 AM
Re: grepping for whole words on HP10.20
How about:
grep -E '(^|[ \t])searchstring([ \t]|$)' file
In English:
Look for a piece of searchstring starting at (the being of a line or with (space or tab)) and ending with ((space or tab) or the end of a line)
fwiw,
Hein.
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.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP