<?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: script help in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497489#M704872</link>
    <description>Joe,&lt;BR /&gt;perl script:&lt;BR /&gt;create an array (@files) and populate with data&lt;BR /&gt;create an empty array(@list)&lt;BR /&gt;&lt;BR /&gt;go through the entries in the files array&lt;BR /&gt;   if the entry ends in a ".dat" append to list array&lt;BR /&gt;&lt;BR /&gt;print each of the entries in the list array&lt;BR /&gt;&lt;BR /&gt;Regards</description>
    <pubDate>Fri, 04 Mar 2005 05:19:04 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2005-03-04T05:19:04Z</dc:date>
    <item>
      <title>script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497487#M704870</link>
      <description>Could someone just tell me what the cshell script does and answer to the perl script?&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/csh&lt;BR /&gt;set list = `ls`&lt;BR /&gt;foreach file ( $list )&lt;BR /&gt;  set size = `wc -c $file`&lt;BR /&gt;  if( (-f $file) &amp;amp;&amp;amp; ($size[1] &amp;lt; 1000) ) echo $file&lt;BR /&gt;end&lt;BR /&gt;---------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;What will the following Perl script print out?&lt;BR /&gt;----------------------------------------------&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl -w&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;my @files = ('something.data',&lt;BR /&gt;             'file.dat',&lt;BR /&gt;             'data.txt',&lt;BR /&gt;             'alpha.datdat',&lt;BR /&gt;             'beta.a.dat');&lt;BR /&gt;my @list  = ();&lt;BR /&gt;&lt;BR /&gt;foreach my $file (@files) {&lt;BR /&gt;    next if ( $file !~ m/\.dat$/i );&lt;BR /&gt;    push(@list, $file);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;foreach my $item (@list) { print "$item\n"; }&lt;BR /&gt;exit;&lt;BR /&gt;&lt;BR /&gt;Please..could anyone help?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Joe</description>
      <pubDate>Thu, 03 Mar 2005 20:13:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497487#M704870</guid>
      <dc:creator>joe_91</dc:creator>
      <dc:date>2005-03-03T20:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497488#M704871</link>
      <description>The cshell script will echo the names of all files (not directories) in the current directory that have less than 1000 characters in them. It does not do a recursive list.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 04 Mar 2005 04:37:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497488#M704871</guid>
      <dc:creator>Stephen Keane</dc:creator>
      <dc:date>2005-03-04T04:37:59Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497489#M704872</link>
      <description>Joe,&lt;BR /&gt;perl script:&lt;BR /&gt;create an array (@files) and populate with data&lt;BR /&gt;create an empty array(@list)&lt;BR /&gt;&lt;BR /&gt;go through the entries in the files array&lt;BR /&gt;   if the entry ends in a ".dat" append to list array&lt;BR /&gt;&lt;BR /&gt;print each of the entries in the list array&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Fri, 04 Mar 2005 05:19:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497489#M704872</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-03-04T05:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497490#M704873</link>
      <description>And the inefficient perl script can be written much shorter:&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/usr/bin/perl -lw&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;my @files = qw(something.data&lt;BR /&gt;file.dat data.txt alpha.datdat beta.a.dat);&lt;BR /&gt;my @list = grep /\.dat$/i =&amp;gt; @files;&lt;BR /&gt;print for @list;&lt;BR /&gt;--&amp;gt;---&lt;BR /&gt;&lt;BR /&gt;the list @files is a list of predefined file names. @list is then stuffed with the names that match the file names that end on .dat (case insensitive), and that list is then printed to the standard output (your screen)&lt;BR /&gt;&lt;BR /&gt;and reduce that to&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/usr/bin/perl -lw&lt;BR /&gt;use strict;&lt;BR /&gt;&lt;BR /&gt;print for grep /\.dat$/i =&amp;gt; qw(something.data&lt;BR /&gt;file.dat data.txt alpha.datdat beta.a.dat);&lt;BR /&gt;--&amp;gt;---&lt;BR /&gt;&lt;BR /&gt;Which was probably an elaborate way to check what would happen on&lt;BR /&gt;&lt;BR /&gt;# perl -lwe'print for grep m/\.dat$/i =&amp;gt; &amp;lt;*dat*&amp;gt;'&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 04 Mar 2005 06:23:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497490#M704873</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-03-04T06:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: script help</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497491#M704874</link>
      <description>Joe,&lt;BR /&gt;is this still a problem?&lt;BR /&gt;If not can you please identify the solution and close the thread, otherwise please update.&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 07 Mar 2005 08:02:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help/m-p/3497491#M704874</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-03-07T08:02:59Z</dc:date>
    </item>
  </channel>
</rss>

