<?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: Perl script that detects a problem in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548525#M678775</link>
    <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I had removed the #!/usr/bin/perl only from the file I ran as a parameter to perl, Like that: perl filter.pl tst4&lt;BR /&gt;&lt;BR /&gt;Yes, either of these are equivalent:&lt;BR /&gt;&lt;BR /&gt;# perl filter.pl tst4&lt;BR /&gt;&lt;BR /&gt;# ./filter.pl tst4&lt;BR /&gt;&lt;BR /&gt;[...where the latter starts with an interpreter line...]&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;If you don't know where Perl lives (or it differs on different servers) you can use this shebang:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/env perl&lt;BR /&gt;&lt;BR /&gt;Notice that there is a whitespace after 'env' and before 'perl'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 11 Dec 2009 20:06:57 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-12-11T20:06:57Z</dc:date>
    <item>
      <title>Perl script that detects a problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548520#M678770</link>
      <description>Perl script that detects a problem&lt;BR /&gt;&lt;BR /&gt;I need a perl code that scans a huge input file and write to stdout or to another file the 3 following records:&lt;BR /&gt;1. The first 32 characters of the previous record.&lt;BR /&gt;2. The first 32 characters of the current record.&lt;BR /&gt;3. A blank line&lt;BR /&gt;&lt;BR /&gt;The above 3 lines are to be written only on (a combination of all of) the following conditions:&lt;BR /&gt;1. The first two characters of the current line are 01, and&lt;BR /&gt;2. The first two characters of the previous line are 99, and&lt;BR /&gt;3. Positions 3 to 32 are equal in the current line to those of the previous line.&lt;BR /&gt;&lt;BR /&gt;Thanks for the answers.&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Dec 2009 15:07:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548520#M678770</guid>
      <dc:creator>yaron1</dc:creator>
      <dc:date>2009-12-11T15:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script that detects a problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548521#M678771</link>
      <description>&lt;!--!*#--&gt;hi:&lt;BR /&gt;&lt;BR /&gt;See if this fits your needs.  Remember, Perl counts zero-relative.  Hence when you say "positions 3-32" I translated this to 2-31 zero-relative.&lt;BR /&gt;&lt;BR /&gt;# cat ./filter&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my $prev = q();&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;    chomp;&lt;BR /&gt;    if (    substr( $_, 0, 2 ) eq "01"&lt;BR /&gt;        and substr( $prev, 0, 2 ) eq "99"&lt;BR /&gt;        and substr( $_, 2, 31 ) eq substr( $prev, 2, 31 ) )&lt;BR /&gt;    {&lt;BR /&gt;        print substr( $prev, 0, 31 ), "\n", substr( $_, 0, 31 ), "\n\n";&lt;BR /&gt;    }&lt;BR /&gt;    $prev = $_;&lt;BR /&gt;}&lt;BR /&gt;1;&lt;BR /&gt;&lt;BR /&gt;...run as:&lt;BR /&gt;&lt;BR /&gt;# ./filter file&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 11 Dec 2009 16:27:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548521#M678771</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-12-11T16:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script that detects a problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548522#M678772</link>
      <description>Itâ  s true about the positions.&lt;BR /&gt;It doesnt work. When I put this code in file â  filterâ   and then in the HP-UX command line I type: &lt;BR /&gt;./filter tst4&lt;BR /&gt;I get:&lt;BR /&gt;./filter[3]: use:  not found.&lt;BR /&gt;./filter[4]: use:  not found.&lt;BR /&gt;./filter[5]: Syntax error at line 5 : `(' is not expected.&lt;BR /&gt;&lt;BR /&gt;If I put the code in file filter.pl (and remove the first 2 lines) and run as:&lt;BR /&gt;perl filter.pl tst4&lt;BR /&gt;I get nothing but I know this condition is met in the input file.&lt;BR /&gt;&lt;BR /&gt;Thanks. &lt;BR /&gt;</description>
      <pubDate>Fri, 11 Dec 2009 18:29:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548522#M678772</guid>
      <dc:creator>yaron1</dc:creator>
      <dc:date>2009-12-11T18:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script that detects a problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548523#M678773</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; It doesnt work. When I put this code in file ...and then in the HP-UX command line I type:&lt;BR /&gt;./filter tst4&lt;BR /&gt;I get:&lt;BR /&gt;./filter[3]: use: not found.&lt;BR /&gt;./filter[4]: use: not found.&lt;BR /&gt;./filter[5]: Syntax error at line 5 : `(' is not expected.&lt;BR /&gt;&lt;BR /&gt;Yes, you would get that if you _REMOVED_ the interpreter ("shebang") line: #!/usr/bin/perl . In this case the shell thought that the script was a shell script!&lt;BR /&gt;&lt;BR /&gt;Every script should begin with a line like that.  For a shell script you would use something like:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;For a Perl script, you would use something like:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF....</description>
      <pubDate>Fri, 11 Dec 2009 18:48:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548523#M678773</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-12-11T18:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script that detects a problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548524#M678774</link>
      <description>I had removed the #!/usr/bin/perl  only from the file I ran as a parameter to perl, Like that:&lt;BR /&gt;perl filter.pl tst4&lt;BR /&gt;I did try to run it also with the #!/usr/bin/perl  line and without the perl, like that:&lt;BR /&gt;filter tst4&lt;BR /&gt;&lt;BR /&gt;shouldnt both ways be the same to run a perl script?&lt;BR /&gt;&lt;BR /&gt;I am using POSIX shell.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 11 Dec 2009 19:42:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548524#M678774</guid>
      <dc:creator>yaron1</dc:creator>
      <dc:date>2009-12-11T19:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script that detects a problem</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548525#M678775</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I had removed the #!/usr/bin/perl only from the file I ran as a parameter to perl, Like that: perl filter.pl tst4&lt;BR /&gt;&lt;BR /&gt;Yes, either of these are equivalent:&lt;BR /&gt;&lt;BR /&gt;# perl filter.pl tst4&lt;BR /&gt;&lt;BR /&gt;# ./filter.pl tst4&lt;BR /&gt;&lt;BR /&gt;[...where the latter starts with an interpreter line...]&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;If you don't know where Perl lives (or it differs on different servers) you can use this shebang:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/env perl&lt;BR /&gt;&lt;BR /&gt;Notice that there is a whitespace after 'env' and before 'perl'.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Dec 2009 20:06:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-that-detects-a-problem/m-p/4548525#M678775</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-12-11T20:06:57Z</dc:date>
    </item>
  </channel>
</rss>

