- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- DCL Search
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-21-2006 02:17 AM
03-21-2006 02:17 AM
search [...]*.for;*
" open(","write","read","call","close(" /output=results.txt
Why does the results.txt file not have the order I searched in above? For example, all of the "write" statements appear in one part of the text file and the "read" statements occur in another part of the text file. I want the results.txt file to display in sequential order: " open(","write","read","call","close(" as it occurs in the fortran file.
Can anyone help me resolve this problem?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2006 02:46 AM
03-21-2006 02:46 AM
SolutionDoes this help ? Tested locally as much as poss, but please check. Assumes you don't have more than 16K worth of files to search.
Hopefully the DCL formatting will remain correct when I post this.
J.
$TOP:
$ FILE=F$SEARCH("[...]*.for;")
$ IF FILE .EQS. ""
$ THEN CREATE RESULTS.TXT;
$ APPEND RESULT.TXT;* RESULTS.TXT;
$ DELETE/NOCONFIRM RESULT.TXT;*
$ EXIT
$ ENDIF
$ OPEN/WRITE O RESULT.TXT;
$ WRITE O "Searching file ''FILE'..."
$ CLOSE O
$ SEARCH/NOWARNING 'FILE' "OPEN(","WRITE","READ","CALL","CLOSE("/OUTPUT=RESULT.TXT
$ GOTO TOP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2006 03:06 AM
03-21-2006 03:06 AM
Re: DCL Search
The SEARCH utility searches for the specified strings in the file(s). It does not work with any relationships between the specified strings, with the exception of the logical operations specified with the /MATCH qualifier.
What you appear to be attempting to do is also subtler than you think, in terms of how many source modules are not written in the "obvious" sequence.
I would suggest using the output of SEARCH as guidance to a manual examination of the source files. Files which contain NONE of the keywords specified can be ignored on a first pass.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2006 03:55 AM
03-21-2006 03:55 AM
Re: DCL Search
I'm wondering if you could explain what it is you want to do with the results once you get them? It may be there is another way to solve your problem.
In order to get the structured search output you are wanting, you'll have to do seperate searches for each string and concatenate the results.
The search utility will list all records in the order found containing any of the search items in a 1-pass scan through the file(s). See Bob Gezelter's comments.
If you could explain what you hope to do with the output and how this will help you solve a particular problem it might be easier to make suggestions.
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2006 04:33 AM
03-21-2006 04:33 AM
Re: DCL Search
awk :== $ SYS$COMMON:[SYSHLP.EXAMPLES.TCPIP.snmp]gawk
awk
%GAWK-W-FILE_RQRD, missing required element: data_file
(use "SYS$INPUT:" to read data lines from the terminal)
usage: GAWK /COMMANDS="awk program text" data_file[,data_file,...]
or GAWK /INPUT=awk_file data_file[,"Var=value",data_file,...]
or GAWK /INPUT=(awk_file1,awk_file2,...) data_file[,...]
options: /FIELD_SEPARATOR="FS_value"
- /VARIABLES=("Var1=value1","Var2=value2",...)
- /LINT /POSIX /[NO]STRICT /VERSION /COPYRIGHT /USAGE
- /OUTPUT=out_file
Or maybe you will want to use some regex, so
- install Perl, which is available on Vms at
http://www.sidhe.org/vmsperl/
- install Python, which is available at vmspython.dyndns.org
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2006 01:54 PM
03-21-2006 01:54 PM
Re: DCL Search
Note: While I am an HPE Employee, all of my comments (whether noted or not), are my own and are not any official representation of the company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2006 02:05 PM
03-21-2006 02:05 PM
Re: DCL Search
This works for me, but needs fine tuning for you.
--------- search.pl -----------------
$wild = shift @ARGV;
$wild =~ s/"//g;
$list = shift @ARGV or die "Usage: $0 ".'"""
@words = split /,/,$list;
while ($file = glob $wild) {
print "\n\n--- $file ---\n\n";
open (FILE,"<$file") or die "failed to open $file for input";
@lines =
foreach $word (@words) {
print foreach (grep (/$word/i, @lines));
}
}
1) grab a wildcarded filespec passed in triple double-quotes.
2) remove remaining double quotes
3) grab comma-seperated word-list
4) stick words into an array
5) walk on the wild side
6) identify current file
7) open current file
8) slurp file into memory array
9) loop over words
10) grep for each words and print if found (case insensitive)
-------------------------------
perl search.pl """*.c""" open,read,write
Now that quoting is ugly and needed to prevent perl from helping.
The alternative is to swap the list and the wildcard around on the command line and let perl expand:
---------- search_2.pl -----------
$list = shift @ARGV or die "Usage: $0
@words = split /,/,$list;
while ($file = shift @ARGV) {
print "\n\n--- $file ---\n\n";
open (FILE,"<$file") or die "failed to open $file for input";
@lines =
foreach $word (@words) {
print foreach (grep (/$word/i, @lines));
}
}
-------------
perl search_2.pl open,read,write *.c
Hope this helps,
Hein.