- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep -w "string" equivalent
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
03-18-2003 11:26 AM
03-18-2003 11:26 AM
grep -w "string" equivalent
I am using grep to search for a string. I want only rows with exact match, Is there a
"grep -w string" equivalent on HP?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2003 11:32 AM
03-18-2003 11:32 AM
Re: grep -w "string" equivalent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2003 11:36 AM
03-18-2003 11:36 AM
Re: grep -w "string" equivalent
The '-w' switch only works with grep in HP-UX 11i. Here is a recent post asking a similar question:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xef3f28c64656d71190080090279cd0f9,00.html
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2003 12:31 PM
03-18-2003 12:31 PM
Re: grep -w "string" equivalent
If you want to grep for a string regardless of case: grep -i " some string "
Note the spaces before and after.
According to the man pages, there is no -w for 10.20 or 11.0 (and very little likelihood that the 11i version will be backported to 11.0, no possibility for the almost obsolete 10.20 systems).
hth
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2003 01:10 PM
03-18-2003 01:10 PM
Re: grep -w "string" equivalent
some text and search string
search string
search string and some text
Standard grep:
# grep "search string" testfile
some text and search string
search string
search string and some text
Syntax to get only exact line match
# grep "^search string$" testfile
search string
The "^" signifies the begining of the line and the "$" signifies the end and, therefore, only an exact match of "search string" (with no other text in the line) will be printed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2003 01:59 PM
03-18-2003 01:59 PM
Re: grep -w "string" equivalent
"grep -w" allows you to search for a word. In other words, "string" preceded/superceded by white space and/or begin/end line.
The use of " string " will only match if the white space is a space, not if it is a
HTH
Marty