<?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 for a specific string in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875113#M34931</link>
    <description>&lt;BR /&gt;And just because I wanted to know how hard a pipe solution would really be:&lt;BR /&gt;&lt;BR /&gt;$ pipe sea tmp.tmp "Name:" | (read sys$pipe x ; y=f$ed(x,"COMPRESS") ; s=" " ; x=f$el(1,s,y)+s+f$el(2,s,y) ; def/job x &amp;amp;x)&lt;BR /&gt;$&lt;BR /&gt;$ show log x&lt;BR /&gt;   "X" = "BOBBY DING" (LNM$JOB_819E9000)&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 05 Oct 2006 10:04:25 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2006-10-05T10:04:25Z</dc:date>
    <item>
      <title>search for a specific string</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875110#M34928</link>
      <description>Hi,&lt;BR /&gt;I have OpenVMS 7.3-2 &lt;BR /&gt;&lt;BR /&gt;My question:&lt;BR /&gt;I want to read a person's name from the file header.&lt;BR /&gt;&lt;BR /&gt;My approach:&lt;BR /&gt;I do a simple search command &lt;BR /&gt;$search File.EXT "Name" /out=Name.txt &lt;BR /&gt;&lt;BR /&gt;It's fine but what this gives me (obviously) is the the entire line &lt;BR /&gt;&lt;BR /&gt;Name:       BOBBY DING            DDSDFD SDDFSD&lt;BR /&gt;&lt;BR /&gt;Now what I need is Bobby Ding from this, the distance between the ":" and B is always 18 so for any of the files the name always starts after 18 character space but the end varies &lt;BR /&gt;So my question is can we get just the name &lt;BR /&gt;&lt;BR /&gt;Bobby Ding in a symbol eg &lt;BR /&gt;&lt;BR /&gt;alpha := Bobby Ding&lt;BR /&gt;&lt;BR /&gt;Let me know your thoughts and comments</description>
      <pubDate>Thu, 05 Oct 2006 09:20:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875110#M34928</guid>
      <dc:creator>nipun_2</dc:creator>
      <dc:date>2006-10-05T09:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: search for a specific string</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875111#M34929</link>
      <description>could this help?&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/freeware/freeware80/extract/" target="_blank"&gt;http://h71000.www7.hp.com/freeware/freeware80/extract/&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 09:24:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875111#M34929</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2006-10-05T09:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: search for a specific string</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875112#M34930</link>
      <description>&amp;gt;&amp;gt; Let me know your thoughts and comments&lt;BR /&gt;&lt;BR /&gt;Read up topic 876934&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=876934" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=876934&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;And learn perl !&lt;BR /&gt;&lt;BR /&gt;$ perl -ne "if (/^Name:\s+(\w+\s+\w+)/){ $ENV{NAME}=$1; last }" tmp.tmp&lt;BR /&gt;$ show log name&lt;BR /&gt;   "NAME" = "BOBBY DING" (LNM$PROCESS_TABLE)&lt;BR /&gt;&lt;BR /&gt;If you don't care about first vs last match then:&lt;BR /&gt;&lt;BR /&gt;$ perl -ne "$ENV{NAME}=$1 if /^Name:\s+(\w+\s+\w+)/" tmp.tmp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As 'bonus' the regexpr will only trigger on lines that start with the "Name". That may help. Drop the "^" if Name: can float on the line. Or use /^\s*name\s*:\s+(\w+\s+\w+)/i&lt;BR /&gt;&lt;BR /&gt;That insists name is the first word on a line and must be followed by a colon, but allows for any whitespace and any case.&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 09:38:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875112#M34930</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-10-05T09:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: search for a specific string</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875113#M34931</link>
      <description>&lt;BR /&gt;And just because I wanted to know how hard a pipe solution would really be:&lt;BR /&gt;&lt;BR /&gt;$ pipe sea tmp.tmp "Name:" | (read sys$pipe x ; y=f$ed(x,"COMPRESS") ; s=" " ; x=f$el(1,s,y)+s+f$el(2,s,y) ; def/job x &amp;amp;x)&lt;BR /&gt;$&lt;BR /&gt;$ show log x&lt;BR /&gt;   "X" = "BOBBY DING" (LNM$JOB_819E9000)&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 10:04:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875113#M34931</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-10-05T10:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: search for a specific string</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875114#M34932</link>
      <description>I just wanted to point out that there are a couple of different ways to use Perl but also set DCL symbols rather than logical names if that's what you need or prefer.&lt;BR /&gt;&lt;BR /&gt;In the following example, I use Hein's Perl code verbatim, but before running it I tell Perl to use DCL symbols rather than logical names for its built-in %ENV hash:&lt;BR /&gt;&lt;BR /&gt;$ define PERL_ENV_TABLES CLISYM_GLOBAL&lt;BR /&gt;$ perl -ne "if (/^Name:\s+(\w+\s+\w+)/){ $ENV{NAME}=$1; last }" tmp.tmp&lt;BR /&gt;$ show symbol name&lt;BR /&gt;  NAME == "BOBBY DING"&lt;BR /&gt;&lt;BR /&gt;If you want local symbols rather than global, use CLISYM_LOCAL as the value of PERL_ENV_TABLES.&lt;BR /&gt;&lt;BR /&gt;Or here's a little hack that uses the VMS::DCLsym extension that's been included with every Perl distribution of the last 10 years or so (and in this example bypasses the documented tied hash inteface and directly uses the internal _setsym method rather than setsym):&lt;BR /&gt;&lt;BR /&gt;$ perl -"MVMS::DCLsym" -ne -&lt;BR /&gt;_$ "if (/^Name:\s+(\w+\s+\w+)/){ VMS::DCLsym::_setsym('NAME',$1,'GLOBAL'); last }" tmp.tmp&lt;BR /&gt;$ show symbol name&lt;BR /&gt;  NAME == "BOBBY DING"&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Oct 2006 12:44:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/search-for-a-specific-string/m-p/3875114#M34932</guid>
      <dc:creator>Craig A Berry</dc:creator>
      <dc:date>2006-10-06T12:44:44Z</dc:date>
    </item>
  </channel>
</rss>

