<?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: shell script to perl in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861196#M98394</link>
    <description>&lt;!--!*#--&gt;I agree with both posters. Also see Wendy's link on how to learn Perl (Wendy is an all-time perl beginner, so she would know :)&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://perlmonks.org/index.pl?node_id=283154" target="_blank"&gt;http://perlmonks.org/index.pl?node_id=283154&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;--- Untested translation&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;my @now = localtime;&lt;BR /&gt;# Using braindead US date format is left as an exercise to the reader&lt;BR /&gt;my $TS = sprintf "DATE: %4d-%02d-%02d TIME: %02d:%02d:%02d", $now[5] + 1900, $now[4] + 1, @now[3,2,1,0];&lt;BR /&gt;&lt;BR /&gt;# print TS to all check_* printers&lt;BR /&gt;my @cfg;&lt;BR /&gt;{   local @ARGV = ("$ENV{DZL_ETC}/dzl_check-dsm-jqm.cfg");&lt;BR /&gt;    chomp (@cfg = &amp;lt;&amp;gt;);&lt;BR /&gt;    }&lt;BR /&gt;foreach my $CHECK (@cfg) {&lt;BR /&gt;    open my $pr, qq{pdpr -x"-job-priority 0" -d $CHECK &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 |" or die "$_: $!\n";&lt;BR /&gt;    print $pr "$TS\n";&lt;BR /&gt;    close $tr;&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;# verify if printout is succesful&lt;BR /&gt;&lt;BR /&gt;sleep (10); # give the printers some seconds to finish&lt;BR /&gt;&lt;BR /&gt;foreach my $CHECK (@cfg) {&lt;BR /&gt;    my $file = "$ENV{DZL_LOG/check_dsm_jqm/$CHECK";&lt;BR /&gt;    local @ARGV = ($file);&lt;BR /&gt;    print "$CHECK $TS ", (grep m/\b$TS\b/ =&amp;gt; &amp;lt;&amp;gt;) ? "OK\n" : "NOK\n";&lt;BR /&gt;    truncate $file, 0; # empty file&lt;BR /&gt;    }&lt;BR /&gt;---&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
    <pubDate>Tue, 12 Sep 2006 11:19:27 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2006-09-12T11:19:27Z</dc:date>
    <item>
      <title>shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861193#M98391</link>
      <description>hello,&lt;BR /&gt;&lt;BR /&gt;i need to recreate a shell script into a perl one (so i can run it on Wintel)&lt;BR /&gt;my Perl knowledege is poor. can you help to recreate these lines?&lt;BR /&gt;&lt;BR /&gt;*****************************************&lt;BR /&gt;&lt;BR /&gt;TS=$(date "+DATE: %m/%d/%y TIME: %H:%M:%S")&lt;BR /&gt;&lt;BR /&gt;# print TS to all check_* printers: ----------------------------#&lt;BR /&gt;&lt;BR /&gt;for CHECK in `cat $DZL_ETC/dzl_check-dsm-jqm.cfg`&lt;BR /&gt;do&lt;BR /&gt;        echo $TS | pdpr -x"-job-priority 0" -d $CHECK &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;# verify if printout is succesful -------------------------------------#&lt;BR /&gt;&lt;BR /&gt;sleep 10                # give the printers some seconds to finish&lt;BR /&gt;&lt;BR /&gt;for CHECK in `cat $DZL_ETC/dzl_check-dsm-jqm.cfg`&lt;BR /&gt; do&lt;BR /&gt;  if $(grep -q "$TS" $DZL_LOG/check_dsm_jqm/$CHECK)&lt;BR /&gt;        then echo "$CHECK       OK      $TS"&lt;BR /&gt;        else echo "$CHECK       NOK     $TS"&lt;BR /&gt;             cat /dev/null &amp;gt; $DZL_LOG/check_dsm_jqm/$CHECK         #empty file&lt;BR /&gt;  fi&lt;BR /&gt; done&lt;BR /&gt;&lt;BR /&gt;*****************************************&lt;BR /&gt;&lt;BR /&gt;thanks to all</description>
      <pubDate>Tue, 12 Sep 2006 08:04:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861193#M98391</guid>
      <dc:creator>Dani_Galera</dc:creator>
      <dc:date>2006-09-12T08:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861194#M98392</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;though you could get advise how to this port from ksh/Posix-SH to perl, I really recommend learning Perl.&lt;BR /&gt;The port of this script, which should be easy, is a good opportunity to do so.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Tue, 12 Sep 2006 08:42:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861194#M98392</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-09-12T08:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861195#M98393</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I agree with Peter.  You should begin your journey learning Perl.  You could start here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://perldoc.perl.org/perlintro.html" target="_blank"&gt;http://perldoc.perl.org/perlintro.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 12 Sep 2006 08:54:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861195#M98393</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-12T08:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861196#M98394</link>
      <description>&lt;!--!*#--&gt;I agree with both posters. Also see Wendy's link on how to learn Perl (Wendy is an all-time perl beginner, so she would know :)&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://perlmonks.org/index.pl?node_id=283154" target="_blank"&gt;http://perlmonks.org/index.pl?node_id=283154&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;--- Untested translation&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;my @now = localtime;&lt;BR /&gt;# Using braindead US date format is left as an exercise to the reader&lt;BR /&gt;my $TS = sprintf "DATE: %4d-%02d-%02d TIME: %02d:%02d:%02d", $now[5] + 1900, $now[4] + 1, @now[3,2,1,0];&lt;BR /&gt;&lt;BR /&gt;# print TS to all check_* printers&lt;BR /&gt;my @cfg;&lt;BR /&gt;{   local @ARGV = ("$ENV{DZL_ETC}/dzl_check-dsm-jqm.cfg");&lt;BR /&gt;    chomp (@cfg = &amp;lt;&amp;gt;);&lt;BR /&gt;    }&lt;BR /&gt;foreach my $CHECK (@cfg) {&lt;BR /&gt;    open my $pr, qq{pdpr -x"-job-priority 0" -d $CHECK &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 |" or die "$_: $!\n";&lt;BR /&gt;    print $pr "$TS\n";&lt;BR /&gt;    close $tr;&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;# verify if printout is succesful&lt;BR /&gt;&lt;BR /&gt;sleep (10); # give the printers some seconds to finish&lt;BR /&gt;&lt;BR /&gt;foreach my $CHECK (@cfg) {&lt;BR /&gt;    my $file = "$ENV{DZL_LOG/check_dsm_jqm/$CHECK";&lt;BR /&gt;    local @ARGV = ($file);&lt;BR /&gt;    print "$CHECK $TS ", (grep m/\b$TS\b/ =&amp;gt; &amp;lt;&amp;gt;) ? "OK\n" : "NOK\n";&lt;BR /&gt;    truncate $file, 0; # empty file&lt;BR /&gt;    }&lt;BR /&gt;---&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Tue, 12 Sep 2006 11:19:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861196#M98394</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-09-12T11:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861197#M98395</link>
      <description>i created the perl script with the help of procura. but now i have a little problem:&lt;BR /&gt;&lt;BR /&gt;i have now this:&lt;BR /&gt;&lt;BR /&gt;@jqm_tmp = `nmcp list | grep jqm | grep ids | grep -v hosts | cut -f1  -d","`;&lt;BR /&gt;&lt;BR /&gt;print jqm_cfg "@jqm_tmp";&lt;BR /&gt;&lt;BR /&gt;normally the result of 'nmcp ...' is something like:&lt;BR /&gt;&lt;BR /&gt;dsm_fax01&lt;BR /&gt;dsm_fax03&lt;BR /&gt;dsm_mail01&lt;BR /&gt;dsm_01a&lt;BR /&gt;dsm_03b&lt;BR /&gt;&lt;BR /&gt;but in the log file (jqm_cfg) i have something like:&lt;BR /&gt;&lt;BR /&gt;dsm_fax01&lt;BR /&gt; dsm_fax03&lt;BR /&gt; dsm_mail01&lt;BR /&gt; dsm_01a&lt;BR /&gt; dsm_03b&lt;BR /&gt;&lt;BR /&gt;do you know how can i remove the blank spaces before the words?&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Sep 2006 07:56:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861197#M98395</guid>
      <dc:creator>Dani_Galera</dc:creator>
      <dc:date>2006-09-13T07:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861198#M98396</link>
      <description>Hi Dani:&lt;BR /&gt;&lt;BR /&gt;The Forum tends to obliterate your formatting unless you check the "retain formatting" box at the bottom of your post.&lt;BR /&gt;&lt;BR /&gt;However, I think you want:&lt;BR /&gt;&lt;BR /&gt;# print jqm_cfg @jqm_tmp;&lt;BR /&gt;&lt;BR /&gt;...instead of the interpolated list (with double-quotes).&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Sep 2006 08:07:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861198#M98396</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-13T08:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: shell script to perl</title>
      <link>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861199#M98397</link>
      <description>Hihi :) :)&lt;BR /&gt;All those blanks get lost in space here on ITRC unless you tick the Retain Format checkbox&lt;BR /&gt;&lt;BR /&gt;That grep is so un-perl!&lt;BR /&gt;&lt;BR /&gt;my @jqm_tmp = map { m/^\s*(.*?)\s*,/; $1 } grep { m/jqm/ &amp;amp;&amp;amp; m/ids/ &amp;amp;&amp;amp; !m/hosts/ } =&amp;gt; `nmcp list`;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 13 Sep 2006 08:09:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/shell-script-to-perl/m-p/3861199#M98397</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2006-09-13T08:09:56Z</dc:date>
    </item>
  </channel>
</rss>

