- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Search a string in files
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
тАО04-12-2010 05:47 PM
тАО04-12-2010 05:47 PM
Not sure whether there are commands available or we need to write a script for this.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2010 06:02 PM
тАО04-12-2010 06:02 PM
Re: Search a string in files
What are you old in?
> [...] all the files.
All _which_ files?
HELP SEARCH
For all the files at or below the current
default directory, something like:
search [...]*.* abc
For all the files on a particular disk,
something like:
search DISK:[000000...]*.* abc
As usual, many things are possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2010 06:20 PM
тАО04-12-2010 06:20 PM
Re: Search a string in files
$ set def DISK:[CUR_DIR]
$ search *.*;* "abc"
To search in the deep rooted directories present in the Current Directory, issue
$ search DISK:[CUR_DIR...]*.*;* "abc"
To search in all directories on a disk
$ search DISK:[000000...]*.*;* "abc"
For more information, have a look at Open VMS help for SEARCH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2010 07:26 PM
тАО04-12-2010 07:26 PM
SolutionDCL SEARCH command is what you have to use.
$SEARCH
Example:
1)$ SEARCH *.TXT "ABCD"
This searches all the "*.TXt" files in the current directory
for the string "ABCD".
2)$ SEARCH $DKA100:[USER]*.* "ABCD"
This searches all the files in the "$DKA100:[USER]" directory
for the string "ABCD".
You can also use the "/STAT" qualifier along with the search to
get some useful stats as number of matches, number of
lines/characters searched in files, time taken and so on.
Refer the DCL help on SEARCH for more details
i.e. $ HELP SEARCH
Regards
Murali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-12-2010 07:44 PM
тАО04-12-2010 07:44 PM
Re: Search a string in files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2010 07:25 PM
тАО04-13-2010 07:25 PM
Re: Search a string in files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2010 08:58 PM
тАО04-13-2010 08:58 PM
Re: Search a string in files
You mentioned.. "You can also use the "/STAT" qualifier along with the search to get some useful stats as number of matches,"
Indeed. And when Jess becomes a little more advanced, He'll appreciated the SYSMBOLS that capture the statistics for further processing.
Personally I've recently started to ditch the full /STAT in favor of /LOG/WIN=0
I feel that this combo often tells me all I need to know: name, records, matches.
Regards,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-13-2010 11:11 PM
тАО04-13-2010 11:11 PM
Re: Search a string in files
Yes, thats a good suggestion.
The "/LOG/WIN=0" will give you brief summary of Name, Record & Matches.
In most cases these information should be sufficient.
I do however use the window qualifer during searching for say some error message in a file. Because this not only gives the error message as output but also lists some code before the error message which would tell why the error is thrown and so on.
I did not use the "/LOG/WIN=0" combination before but would use it going forward.
Thanks N Regards,
Murali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2010 09:07 AM
тАО04-14-2010 09:07 AM
Re: Search a string in files
That is very cool. I use /STAT to do reporting on log files.
I didn't think of using /WIN=0/LOG to provide a filter to serach for MATCHED / NOMATCH.
%SEARCH-S-NOMATCH
%SEARCH-S-MATCHED
PIPE sea *.log error /win=0/log | sea sys$input MATCHED
This provides a me a easy way to identify files quickly that need to be parsed for additonal info.
Thank you, you just made my day.
Don
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2010 01:41 PM
тАО04-18-2010 01:41 PM
Re: Search a string in files
If you're OpenVMS V8 or higher, SEARCH/STAT defines symbols, so there's no need to parse the output:
$ PIPE search/stat/nolog/noout login.com "$" >nl: 2>nl:
$ show sym search$*
SEARCH$CHARACTERS_SEARCHED = "1222"
SEARCH$FILES_SEARCHED = "1"
SEARCH$LINES_PRINTED = "0"
SEARCH$RECORDS_MATCHED = "46"
SEARCH$RECORDS_SEARCHED = "46"
I'm using PIPE for output redirection to throw away any output or errors from SEARCH. Since it's a single command, it's executed in the context of the current process.