- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- Search a string in files
-
- Forums
-
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
- HPE Blog, Austria, Germany & Switzerland
- Blog HPE, France
- HPE Blog, Italy
- HPE Blog, Japan
- HPE Blog, Middle East
- HPE Blog, Russia
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
-
Blogs
- Advancing Life & Work
- Advantage EX
- Alliances
- Around the Storage Block
- HPE Blog, Latin America
- HPE Blog, Middle East
- HPE Blog, Saudi Arabia
- HPE Blog, South Africa
- HPE Blog, UK & Ireland
- HPE Ezmeral: Uncut
- OEM Solutions
- Servers & Systems: The Right Compute
- Tech Insights
- The Cloud Experience Everywhere
-
Information
- Community
- Welcome
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Tips and Tricks
- Resources
- Announcements
- Email us
- Feedback
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Aruba Airheads Community
- Enterprise.nxt
- HPE Dev Community
- Cloud28+ Community
- Marketplace
-
Forums
-
Blogs
-
Information
-
English
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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
- Email to a Friend
- 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.
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2021 Hewlett Packard Enterprise Development LP