<?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: search file and size in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591675#M39562</link>
    <description>Well unfortunately SEARCH doesn't have the /SELECT=(SIZE=MAXIMUM:20000) option (or does it nowadays?) like DIRECTORY.&lt;BR /&gt;One of the "do this on a list of files", namely EACH.COM does work on the directory output like this:&lt;BR /&gt;&lt;BR /&gt;@EACH *.msg;/select=(size=maximum:20000) -&lt;BR /&gt;"pipe search/win=0 'S' &lt;PATTERN&gt; &amp;amp;&amp;amp; write lis S"&lt;BR /&gt;where lis is the listing file opend by DCL before the command (closed aferwards), or replace the write statement by a commandfile writing the argument (S) to the desired list file.&lt;BR /&gt;&lt;BR /&gt;get EACH.COM from the freeware disks or from my server:&lt;BR /&gt;&lt;BR /&gt; &lt;A href="http://wwwvms.mpp.mpg.de/vms$common/com/each.com" target="_blank"&gt;http://wwwvms.mpp.mpg.de/vms$common/com/each.com&lt;/A&gt;&lt;/PATTERN&gt;</description>
    <pubDate>Fri, 26 Feb 2010 15:56:58 GMT</pubDate>
    <dc:creator>Joseph Huber_1</dc:creator>
    <dc:date>2010-02-26T15:56:58Z</dc:date>
    <item>
      <title>search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591672#M39559</link>
      <description>&lt;!--!*#--&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I've got a lots of files and I need to select that ones matching a given pattern but also I need to avoid files which size is bigger than a certain value.&lt;BR /&gt;&lt;BR /&gt;I use the following search command:&lt;BR /&gt;&lt;BR /&gt;search/win=0 *.msg;* &lt;PATTERN&gt; /out=file_list.lis&lt;BR /&gt;&lt;BR /&gt;and the file_list.lis got, one per line, the absolute paths to the searched files.  &lt;BR /&gt;&lt;BR /&gt;But I don't know how to keep off the list all the files bigger than 10mb.&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Salvatore&lt;/PATTERN&gt;</description>
      <pubDate>Fri, 26 Feb 2010 14:19:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591672#M39559</guid>
      <dc:creator>sleone</dc:creator>
      <dc:date>2010-02-26T14:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591673#M39560</link>
      <description>You should turn that around.&lt;BR /&gt;Find the smaller files first, then search.&lt;BR /&gt;It would be wasteful to search through lots and lots of megabytes to find a hit (or not) and then to hdisgard that work.&lt;BR /&gt;&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Feb 2010 15:30:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591673#M39560</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-02-26T15:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591674#M39561</link>
      <description>Salvatore,&lt;BR /&gt;&lt;BR /&gt;it may not be possible to do what you want with one single standard OpenVMS command, but you could easily write a DCL procedure:&lt;BR /&gt;&lt;BR /&gt;DIR/SEL=SIZ=MAX=20000000/OUT=x.x/COL=1 *.msg;*&lt;BR /&gt;&lt;BR /&gt;DEFINE SYS$OUTPUT file_list.lis&lt;BR /&gt;&lt;BR /&gt;Open and read x.x and do a SEARCH 'file.msg' &lt;PATTERN&gt;&lt;BR /&gt;&lt;BR /&gt;for all files found in file x.x&lt;BR /&gt;&lt;BR /&gt;DEASSIGN SYS$OUTPUT&lt;BR /&gt;&lt;BR /&gt;Volker.&lt;/PATTERN&gt;</description>
      <pubDate>Fri, 26 Feb 2010 15:43:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591674#M39561</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2010-02-26T15:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591675#M39562</link>
      <description>Well unfortunately SEARCH doesn't have the /SELECT=(SIZE=MAXIMUM:20000) option (or does it nowadays?) like DIRECTORY.&lt;BR /&gt;One of the "do this on a list of files", namely EACH.COM does work on the directory output like this:&lt;BR /&gt;&lt;BR /&gt;@EACH *.msg;/select=(size=maximum:20000) -&lt;BR /&gt;"pipe search/win=0 'S' &lt;PATTERN&gt; &amp;amp;&amp;amp; write lis S"&lt;BR /&gt;where lis is the listing file opend by DCL before the command (closed aferwards), or replace the write statement by a commandfile writing the argument (S) to the desired list file.&lt;BR /&gt;&lt;BR /&gt;get EACH.COM from the freeware disks or from my server:&lt;BR /&gt;&lt;BR /&gt; &lt;A href="http://wwwvms.mpp.mpg.de/vms$common/com/each.com" target="_blank"&gt;http://wwwvms.mpp.mpg.de/vms$common/com/each.com&lt;/A&gt;&lt;/PATTERN&gt;</description>
      <pubDate>Fri, 26 Feb 2010 15:56:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591675#M39562</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-02-26T15:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591676#M39563</link>
      <description>Thank you!&lt;BR /&gt;&lt;BR /&gt;I will try your suggestions useful suggestions!</description>
      <pubDate>Fri, 26 Feb 2010 16:50:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591676#M39563</guid>
      <dc:creator>sleone</dc:creator>
      <dc:date>2010-02-26T16:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591677#M39564</link>
      <description>&lt;!--!*#--&gt;Given your first approach you coudl post-filter the search output with PERL or DCL.&lt;BR /&gt;&lt;BR /&gt;I use a bunch of .COB files as test, looking for the string 'test' and the size cutoff at 2000 byte = 4 blocks (approx). It all worked (fr me :-)&lt;BR /&gt;&lt;BR /&gt;$ pipe  sea *.cob test/win=0/nowarn | perl -lne "chomp; print if (-s) &amp;gt; 2000" &amp;gt; file_list.lis&lt;BR /&gt;&lt;BR /&gt;Or with a command file &lt;BR /&gt;------- tmp.com ----&lt;BR /&gt;$loop:&lt;BR /&gt;$read/end=done sys$pipe filename&lt;BR /&gt;$if f$file(filename,"EOF").gt.4 then write sys$output filename&lt;BR /&gt;$goto loop&lt;BR /&gt;$done:&lt;BR /&gt;--------&lt;BR /&gt;&lt;BR /&gt;$pipe  sea *.cob test/win=0/nowarn | @tmp /out= file_list.lis&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now let's turn the roles around:&lt;BR /&gt;&lt;BR /&gt;------- tmp.com ------------&lt;BR /&gt;$loop:&lt;BR /&gt;$read/end=done sys$pipe filename&lt;BR /&gt;$searc /win=0/nowarn 'filename' 'p1'&lt;BR /&gt;$goto loop&lt;BR /&gt;$done:&lt;BR /&gt;-------------&lt;BR /&gt;&lt;BR /&gt;$ pipe dir/sele=siz=max=4/nohead/notrai *.cob; | @tmp test&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Myself, I use perl 'one-liners' for jobs like this:&lt;BR /&gt;&lt;BR /&gt;$ perl -le "for $f (&amp;lt;*.cob&amp;gt;){ next if -s $f &amp;lt;5000; open (F, ""&amp;lt;$f""); while (&lt;F&gt;) { if (/test/i) {print $f; last}}}"&lt;BR /&gt;&lt;BR /&gt;As a perl 'script' that looks like.&lt;BR /&gt;&lt;BR /&gt;for $f (&amp;lt;*.cob&amp;gt;) {   # GLOB over selected files&lt;BR /&gt;  next if -s $f &amp;lt;5000; # check size in bytes&lt;BR /&gt;  open (F, "&amp;lt;$f");  # open file for read on handle F&lt;BR /&gt;  while (&lt;F&gt;) { # loop through file F&lt;BR /&gt;    if (/test/i) { # match desired string?&lt;BR /&gt;       print $f; # &lt;BR /&gt;       last&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;/F&gt;&lt;/F&gt;</description>
      <pubDate>Sat, 27 Feb 2010 02:35:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591677#M39564</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-02-27T02:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: search file and size</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591678#M39565</link>
      <description>Salvatore,&lt;BR /&gt;  One other improvement...&lt;BR /&gt;&lt;BR /&gt;search/win=0 *.msg;* &lt;PATTERN&gt; /out=file_list.lis&lt;BR /&gt;&lt;BR /&gt;Since you're not looking at the actual matches, once you've found one, there's no need to continue searching the file so add /LIMIT=1&lt;BR /&gt;&lt;BR /&gt;Simple example: searching a bunch of command procedures for "!". Statistics without /LIMIT=1&lt;BR /&gt;&lt;BR /&gt;Files searched:               142       Buffered I/O count:       546&lt;BR /&gt;Records searched:           30227       Direct I/O count:         144&lt;BR /&gt;Characters searched:       846068       Page faults:               28&lt;BR /&gt;Records matched:             3198       Elapsed CPU time:  0 00:00:00.11&lt;BR /&gt;Lines printed:                115       Elapsed time:      0 00:00:00.13&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;and with /LIMIT=1&lt;BR /&gt;&lt;BR /&gt;Files searched:               142       Buffered I/O count:       546&lt;BR /&gt;Records searched:            2409       Direct I/O count:         144&lt;BR /&gt;Characters searched:        75626       Page faults:               28&lt;BR /&gt;Records matched:              115       Elapsed CPU time:  0 00:00:00.06&lt;BR /&gt;Lines printed:                115       Elapsed time:      0 00:00:00.07&lt;BR /&gt;&lt;BR /&gt;Same list of files output, but half the time!&lt;BR /&gt;&lt;BR /&gt;Note - if your 10Mb files are likely to have your pattern somewhere near the start, you may not need to exclude them.&lt;/PATTERN&gt;</description>
      <pubDate>Sun, 28 Feb 2010 23:28:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-file-and-size/m-p/4591678#M39565</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2010-02-28T23:28:31Z</dc:date>
    </item>
  </channel>
</rss>

