<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: DCL Search in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755843#M33894</link>
    <description>If you are familiar with awk, it is available with Tcpip 5.any, cleverly hidden.&lt;BR /&gt;&lt;BR /&gt;awk :== $ SYS$COMMON:[SYSHLP.EXAMPLES.TCPIP.snmp]gawk&lt;BR /&gt;&lt;BR /&gt;awk&lt;BR /&gt;&lt;BR /&gt;%GAWK-W-FILE_RQRD, missing required element: data_file &lt;BR /&gt;       (use "SYS$INPUT:" to read data lines from the terminal) &lt;BR /&gt;&lt;BR /&gt;usage:  GAWK  /COMMANDS="awk program text"  data_file[,data_file,...] &lt;BR /&gt;   or   GAWK  /INPUT=awk_file  data_file[,"Var=value",data_file,...] &lt;BR /&gt;   or   GAWK  /INPUT=(awk_file1,awk_file2,...)  data_file[,...] &lt;BR /&gt;&lt;BR /&gt;options:  /FIELD_SEPARATOR="FS_value" &lt;BR /&gt;   -      /VARIABLES=("Var1=value1","Var2=value2",...) &lt;BR /&gt;   -      /LINT  /POSIX  /[NO]STRICT  /VERSION  /COPYRIGHT  /USAGE &lt;BR /&gt;   -      /OUTPUT=out_file &lt;BR /&gt;&lt;BR /&gt;Or maybe you will want to use some regex, so&lt;BR /&gt;&lt;BR /&gt;- install Perl, which is available on Vms at &lt;BR /&gt;&lt;A href="http://www.sidhe.org/vmsperl/" target="_blank"&gt;http://www.sidhe.org/vmsperl/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;- install Python, which is available at vmspython.dyndns.org</description>
    <pubDate>Tue, 21 Mar 2006 12:33:22 GMT</pubDate>
    <dc:creator>labadie_1</dc:creator>
    <dc:date>2006-03-21T12:33:22Z</dc:date>
    <item>
      <title>DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755839#M33890</link>
      <description>I am trying to create a text file searching multiple fortran files.  I want to see each time OPEN,WRITE,READ,CALL AND CLOSE occurs in this order for each file. The command I am using is:&lt;BR /&gt;&lt;BR /&gt;search [...]*.for;* &lt;BR /&gt;" open(","write","read","call","close(" /output=results.txt&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Can anyone help me resolve this problem?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 21 Mar 2006 10:17:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755839#M33890</guid>
      <dc:creator>Kenneth Toler</dc:creator>
      <dc:date>2006-03-21T10:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755840#M33891</link>
      <description>Hi Kenneth,&lt;BR /&gt;&lt;BR /&gt;Does this help ? Tested locally as much as poss, but please check. Assumes you don't have more than 16K worth of files to search.&lt;BR /&gt;&lt;BR /&gt;Hopefully the DCL formatting will remain correct when I post this.&lt;BR /&gt;&lt;BR /&gt;J.&lt;BR /&gt;&lt;BR /&gt;$TOP:&lt;BR /&gt;$ FILE=F$SEARCH("[...]*.for;")&lt;BR /&gt;$ IF FILE .EQS. ""&lt;BR /&gt;$ THEN CREATE RESULTS.TXT;&lt;BR /&gt;$      APPEND RESULT.TXT;* RESULTS.TXT;&lt;BR /&gt;$      DELETE/NOCONFIRM RESULT.TXT;*&lt;BR /&gt;$      EXIT&lt;BR /&gt;$ ENDIF&lt;BR /&gt;$ OPEN/WRITE O RESULT.TXT;&lt;BR /&gt;$ WRITE O "Searching file ''FILE'..."&lt;BR /&gt;$ CLOSE O&lt;BR /&gt;$ SEARCH/NOWARNING 'FILE' "OPEN(","WRITE","READ","CALL","CLOSE("/OUTPUT=RESULT.TXT&lt;BR /&gt;$ GOTO TOP</description>
      <pubDate>Tue, 21 Mar 2006 10:46:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755840#M33891</guid>
      <dc:creator>John Abbott_2</dc:creator>
      <dc:date>2006-03-21T10:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755841#M33892</link>
      <description>Kenneth,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Tue, 21 Mar 2006 11:06:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755841#M33892</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2006-03-21T11:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755842#M33893</link>
      <description>Hi Kenneth,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Robert</description>
      <pubDate>Tue, 21 Mar 2006 11:55:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755842#M33893</guid>
      <dc:creator>Robert_Boyd</dc:creator>
      <dc:date>2006-03-21T11:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755843#M33894</link>
      <description>If you are familiar with awk, it is available with Tcpip 5.any, cleverly hidden.&lt;BR /&gt;&lt;BR /&gt;awk :== $ SYS$COMMON:[SYSHLP.EXAMPLES.TCPIP.snmp]gawk&lt;BR /&gt;&lt;BR /&gt;awk&lt;BR /&gt;&lt;BR /&gt;%GAWK-W-FILE_RQRD, missing required element: data_file &lt;BR /&gt;       (use "SYS$INPUT:" to read data lines from the terminal) &lt;BR /&gt;&lt;BR /&gt;usage:  GAWK  /COMMANDS="awk program text"  data_file[,data_file,...] &lt;BR /&gt;   or   GAWK  /INPUT=awk_file  data_file[,"Var=value",data_file,...] &lt;BR /&gt;   or   GAWK  /INPUT=(awk_file1,awk_file2,...)  data_file[,...] &lt;BR /&gt;&lt;BR /&gt;options:  /FIELD_SEPARATOR="FS_value" &lt;BR /&gt;   -      /VARIABLES=("Var1=value1","Var2=value2",...) &lt;BR /&gt;   -      /LINT  /POSIX  /[NO]STRICT  /VERSION  /COPYRIGHT  /USAGE &lt;BR /&gt;   -      /OUTPUT=out_file &lt;BR /&gt;&lt;BR /&gt;Or maybe you will want to use some regex, so&lt;BR /&gt;&lt;BR /&gt;- install Perl, which is available on Vms at &lt;BR /&gt;&lt;A href="http://www.sidhe.org/vmsperl/" target="_blank"&gt;http://www.sidhe.org/vmsperl/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;- install Python, which is available at vmspython.dyndns.org</description>
      <pubDate>Tue, 21 Mar 2006 12:33:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755843#M33894</guid>
      <dc:creator>labadie_1</dc:creator>
      <dc:date>2006-03-21T12:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755844#M33895</link>
      <description>Add the "/head" qualifier so you see each file in which Search finds the desired strings.</description>
      <pubDate>Tue, 21 Mar 2006 21:54:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755844#M33895</guid>
      <dc:creator>Sheldon Smith</dc:creator>
      <dc:date>2006-03-21T21:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: DCL Search</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755845#M33896</link>
      <description>&lt;BR /&gt;This works for me, but needs fine tuning for you.&lt;BR /&gt;&lt;BR /&gt;--------- search.pl -----------------&lt;BR /&gt;$wild = shift @ARGV;&lt;BR /&gt;$wild =~ s/"//g;&lt;BR /&gt;$list = shift @ARGV or die "Usage: $0 ".'"""&lt;WILDCARD-FILESPEC&gt;""" &lt;SEARCH-LIST&gt;';&lt;BR /&gt;@words = split /,/,$list;&lt;BR /&gt;while ($file = glob $wild) {&lt;BR /&gt;  print "\n\n--- $file ---\n\n";&lt;BR /&gt;  open (FILE,"&amp;lt;$file") or die "failed to open $file for input";&lt;BR /&gt;  @lines = &lt;FILE&gt;;&lt;BR /&gt;  foreach $word (@words) {&lt;BR /&gt;   print foreach (grep (/$word/i, @lines));&lt;BR /&gt;   }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;1) grab a wildcarded filespec passed in triple double-quotes.&lt;BR /&gt;2) remove remaining double quotes&lt;BR /&gt;3) grab comma-seperated word-list&lt;BR /&gt;4) stick words into an array&lt;BR /&gt;5) walk on the wild side&lt;BR /&gt;6) identify current file&lt;BR /&gt;7) open current file&lt;BR /&gt;8) slurp file into memory array&lt;BR /&gt;9) loop over words&lt;BR /&gt;10) grep for each words and print if found (case insensitive)&lt;BR /&gt;-------------------------------&lt;BR /&gt;perl search.pl """*.c""" open,read,write&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now that quoting is ugly and needed to prevent perl from helping.&lt;BR /&gt;The alternative is to swap the list and the wildcard around on the command line and let perl expand:&lt;BR /&gt;&lt;BR /&gt;---------- search_2.pl -----------&lt;BR /&gt;$list = shift @ARGV or die "Usage: $0 &lt;SEARCH-LIST&gt; &lt;WILDCARD-FILESPEC&gt;";&lt;BR /&gt;@words = split /,/,$list;&lt;BR /&gt;while ($file = shift @ARGV) {&lt;BR /&gt;  print "\n\n--- $file ---\n\n";&lt;BR /&gt;  open (FILE,"&amp;lt;$file") or die "failed to open $file for input";&lt;BR /&gt;  @lines = &lt;FILE&gt;;&lt;BR /&gt;  foreach $word (@words) {&lt;BR /&gt;   print foreach (grep (/$word/i, @lines));&lt;BR /&gt;   }&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;-------------&lt;BR /&gt;perl search_2.pl  open,read,write *.c&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;/FILE&gt;&lt;/WILDCARD-FILESPEC&gt;&lt;/SEARCH-LIST&gt;&lt;/FILE&gt;&lt;/SEARCH-LIST&gt;&lt;/WILDCARD-FILESPEC&gt;</description>
      <pubDate>Tue, 21 Mar 2006 22:05:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/dcl-search/m-p/3755845#M33896</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-21T22:05:42Z</dc:date>
    </item>
  </channel>
</rss>

