HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Searching for text in a file
Operating System - HP-UX
1827444
Members
6224
Online
109965
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
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
02-28-2001 11:14 AM
02-28-2001 11:14 AM
Searching for text in a file
How do I search from root login for a specific word located in a file. I don't have any idea what file or what directory. I think it has something to do with the STRINGS command but I'm not sure.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2001 11:22 AM
02-28-2001 11:22 AM
Re: Searching for text in a file
If this is a text file, you can use grep. Various options are available in using grep, check the man page.
grep -l filename
Here it will output the names of the file that contain the pattern you are looking for. Again, check the man pages for the options you might want to use.
grep -l
Here it will output the names of the file that contain the pattern you are looking for. Again, check the man pages for the options you might want to use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2001 11:58 AM
02-28-2001 11:58 AM
Re: Searching for text in a file
You coud use the find command to a directory or the whole system depending on where you start. You could use;
find / -type f -exec grep -il {search_string} {} \;
This will give you the file names where the string appears. You can then use grep if a textfile, or strings if a binary, to look at each file
find / -type f -exec grep -il {search_string} {} \;
This will give you the file names where the string appears. You can then use grep if a textfile, or strings if a binary, to look at each file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2001 01:47 PM
02-28-2001 01:47 PM
Re: Searching for text in a file
If it is a binary file then strings can help.
You may want to combine the methods discussed try:
strings /etc/uname | grep license
it gets every occurance of the string "license"
Add in find and you can search the disk.
You may want to combine the methods discussed try:
strings /etc/uname | grep license
it gets every occurance of the string "license"
Add in find and you can search the disk.
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