<?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: Spaces in file causing problems with my array in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528501#M701418</link>
    <description>Do I do that as part of defining the array , or after defining the array.&lt;BR /&gt;IE&lt;BR /&gt;@LIST=(split/ /,($line));&lt;BR /&gt;tr /  / /;</description>
    <pubDate>Wed, 20 Apr 2005 05:33:56 GMT</pubDate>
    <dc:creator>Steve_617</dc:creator>
    <dc:date>2005-04-20T05:33:56Z</dc:date>
    <item>
      <title>Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528499#M701416</link>
      <description>I wrote the following perl scripts but when there are multiple spaces it does not perform the way I though it should. The script looks like this&lt;BR /&gt;#!/usr/bin/perl -w&lt;BR /&gt;`rm /tmp/tmp1/*`;&lt;BR /&gt;`cat /home1/reports/output/ljhbdss1/tmpftp &amp;gt;/tmp/tmp1/tmpfile`;&lt;BR /&gt;`cat /home1/reports/output/lptadss1/tmpftp &amp;gt;&amp;gt;/tmp/tmp1/tmpfile`;&lt;BR /&gt;`cat /home1/reports/output/lblmdss1/tmpftp &amp;gt;&amp;gt;/tmp/tmp1/tmpfile`;&lt;BR /&gt;`cat /home1/reports/output/lctndss1/tmpftp &amp;gt;&amp;gt;/tmp/tmp1/tmpfile`;&lt;BR /&gt;`cat /home1/reports/output/lpthdss1/tmpftp &amp;gt;&amp;gt;/tmp/tmp1/tmpfile`;&lt;BR /&gt;`cat /home1/reports/output/ldbndss1/tmpftp &amp;gt;&amp;gt;/tmp/tmp1/tmpfile`;&lt;BR /&gt;&lt;BR /&gt;open (FOA, " &amp;gt; /tmp/tmp1/tmp.avg");&lt;BR /&gt;open (FOT, " &amp;gt; /tmp/tmp1/tmp.det");&lt;BR /&gt;open (FI, "&amp;lt; /tmp/tmp1/tmpfile") or die "Cannot find ljhbdss1 tmp file";&lt;BR /&gt;while ($line=&lt;FI&gt;)&lt;BR /&gt;{&lt;BR /&gt;@LIST=(split/ /,($line));&lt;BR /&gt;chomp @LIST;&lt;BR /&gt;$var=$LIST[1];&lt;BR /&gt;print "creating $var\n";&lt;BR /&gt;sleep 1;&lt;BR /&gt;open (FN, "&amp;gt;&amp;gt; /tmp/tmp1/$var");&lt;BR /&gt;print FN @LIST,"\n";&lt;BR /&gt;close FN;&lt;BR /&gt;}&lt;BR /&gt;close FI;&lt;BR /&gt;close FOA;&lt;BR /&gt;close FOT;&lt;BR /&gt;exit&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The input files has the following entries.&lt;BR /&gt;13.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;14.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;15.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;16.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;17.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;18.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;19.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;20.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;20.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;r141DMZ1       Month_Availability         100.00&lt;BR /&gt;&lt;BR /&gt;It bombs when reading the Month_Availability.&lt;BR /&gt;&lt;BR /&gt;Can anyone show me how to eliminate the double spaces or ignore them preferably.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;/FI&gt;</description>
      <pubDate>Wed, 20 Apr 2005 05:16:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528499#M701416</guid>
      <dc:creator>Steve_617</dc:creator>
      <dc:date>2005-04-20T05:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528500#M701417</link>
      <description>tr -s "XX" "X"&lt;BR /&gt;&lt;BR /&gt;REPLACE the X's with same number of SPACES&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Wed, 20 Apr 2005 05:28:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528500#M701417</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-04-20T05:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528501#M701418</link>
      <description>Do I do that as part of defining the array , or after defining the array.&lt;BR /&gt;IE&lt;BR /&gt;@LIST=(split/ /,($line));&lt;BR /&gt;tr /  / /;</description>
      <pubDate>Wed, 20 Apr 2005 05:33:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528501#M701418</guid>
      <dc:creator>Steve_617</dc:creator>
      <dc:date>2005-04-20T05:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528502#M701419</link>
      <description>Nope,&lt;BR /&gt;&lt;BR /&gt;open (FI, 'cat /tmp/tmp1/tmpfile|tr -s "XX" "X"|') or die "Cannot find ljhbdss1 tmp file";&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry d brown jr</description>
      <pubDate>Wed, 20 Apr 2005 05:41:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528502#M701419</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2005-04-20T05:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528503#M701420</link>
      <description>Steve,&lt;BR /&gt;where are the double spaces in your input data file?&lt;BR /&gt;&lt;BR /&gt;From what I see:&lt;BR /&gt;read the input file&lt;BR /&gt;append the record to a file named as the second field&lt;BR /&gt;&lt;BR /&gt;This should create 1 file called r141DMZ1 with 9 records and 1 file called Month_Availability with 1 record.&lt;BR /&gt;Is this correct?&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 20 Apr 2005 06:00:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528503#M701420</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-04-20T06:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528504#M701421</link>
      <description>Yes this is correct&lt;BR /&gt;But the field &lt;BR /&gt;r141DMZ1 Month_Availability 100.00&lt;BR /&gt;has spaces in between and at the end after the 100.00, causing me more greay hairs.&lt;BR /&gt;So it looks like this &lt;BR /&gt;20.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;20.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;r141DMZ1   Month_Availability  100.00    &lt;BR /&gt;&lt;BR /&gt;I would like to replace all the spaces regardless of how much with just one and obviously no spaces at the end.&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Apr 2005 06:11:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528504#M701421</guid>
      <dc:creator>Steve_617</dc:creator>
      <dc:date>2005-04-20T06:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528505#M701422</link>
      <description>I see the view removes the spaces so I will display the unwanted spaces with x's&lt;BR /&gt;19.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;20.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;20.04.2005 r141DMZ1 10.203.63.6 100&lt;BR /&gt;r141DMZ1 xxxMonth_Availability xxx100.00xxxx&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Apr 2005 06:28:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528505#M701422</guid>
      <dc:creator>Steve_617</dc:creator>
      <dc:date>2005-04-20T06:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528506#M701423</link>
      <description>Steve,&lt;BR /&gt;thanks for the details.&lt;BR /&gt;Can you replace the &lt;BR /&gt;@LIST=(split/ /,($line));&lt;BR /&gt;with&lt;BR /&gt;@LIST=(split/\s+/,($line));&lt;BR /&gt;and try again.&lt;BR /&gt;&lt;BR /&gt;But it seems you are already happy with Harry's fix.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Wed, 20 Apr 2005 06:41:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528506#M701423</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-04-20T06:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528507#M701424</link>
      <description>Now first let's make it more perlish&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;unlink ;&lt;BR /&gt;&lt;BR /&gt;# Use magic open&lt;BR /&gt;@ARGV = map { "/home1/reports/output/$_/tmpftp" } qw( ljhbdss1 lptadss1 lblmdss1 lctndss1 lpthdss1 ldbndss1 );&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;chomp (my @LIST = split /\s+/, $_, -1);&lt;BR /&gt;$var=$LIST[1];&lt;BR /&gt;print "creating $var\n";&lt;BR /&gt;sleep 1;&lt;BR /&gt;open my $fn, "&amp;gt;&amp;gt; /tmp/tmp1/$var" or die "$var: $!";&lt;BR /&gt;print $fn @LIST, "\n";&lt;BR /&gt;close $fn;&lt;BR /&gt;}&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;Much more readable IMHO&lt;BR /&gt;&lt;BR /&gt;I removed FOA and FOT, because they're not used in the snippet&lt;BR /&gt;&lt;BR /&gt;It also splits on one or more whitespace characters&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Wed, 20 Apr 2005 06:41:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528507#M701424</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-04-20T06:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528508#M701425</link>
      <description>Thought it was working but I am getting the following error message&lt;BR /&gt;Global symbol "$var" requires explicit package name at ./DayWeb.pl line 12.&lt;BR /&gt;Global symbol "$var" requires explicit package name at ./DayWeb.pl line 13.&lt;BR /&gt;Global symbol "$var" requires explicit package name at ./DayWeb.pl line 15.&lt;BR /&gt;Global symbol "$var" requires explicit package name at ./DayWeb.pl line 15.&lt;BR /&gt;Execution of ./DayWeb.pl aborted due to compilation errors.&lt;BR /&gt;$</description>
      <pubDate>Wed, 20 Apr 2005 06:59:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528508#M701425</guid>
      <dc:creator>Steve_617</dc:creator>
      <dc:date>2005-04-20T06:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528509#M701426</link>
      <description>Steve,&lt;BR /&gt;use strict; dictates amongst other things that all variables have to be declared with my()&lt;BR /&gt;&lt;BR /&gt;Can you replace &lt;BR /&gt;$var=$LIST[1];&lt;BR /&gt;with&lt;BR /&gt;my($var)=$LIST[1];&lt;BR /&gt;and re-run.&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 20 Apr 2005 07:13:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528509#M701426</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2005-04-20T07:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528510#M701427</link>
      <description>Yes. true. sorry 'bout that.&lt;BR /&gt;One more thing. The lines printed in the seperate files will (or at least might) differ from the lines in the original file due to the new splitting. If you want the original lines, do this&lt;BR /&gt;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;my $var = (split /\s+/, $_, -1)[1];&lt;BR /&gt;print "creating $var\n";&lt;BR /&gt;#sleep 1; # I also commented out the sleep.&lt;BR /&gt;open my $fn, "&amp;gt;&amp;gt; /tmp/tmp1/$var" or die "$var: $!";&lt;BR /&gt;print $fn;&lt;BR /&gt;close $fn;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn [ who likes simple, short and readable code ]</description>
      <pubDate>Wed, 20 Apr 2005 07:30:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528510#M701427</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2005-04-20T07:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Spaces in file causing problems with my array</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528511#M701428</link>
      <description>Hi Guys thanks for your help.&lt;BR /&gt;&lt;BR /&gt;I am still having a problem with the spaces though as it seems to remove too many spaces in SOME CASES. HEre is the output&lt;BR /&gt;$ more *&lt;BR /&gt;::::::::::::::&lt;BR /&gt;100.00&lt;BR /&gt;::::::::::::::&lt;BR /&gt;Month_Availability100.00&lt;BR /&gt;Month_Availability100.00&lt;BR /&gt;Month_Availability100.00&lt;BR /&gt;::::::::::::::&lt;BR /&gt;29.24&lt;BR /&gt;::::::::::::::&lt;BR /&gt;Month_Availability29.24&lt;BR /&gt;::::::::::::::&lt;BR /&gt;96.58&lt;BR /&gt;::::::::::::::&lt;BR /&gt;Month_Availability96.58&lt;BR /&gt;::::::::::::::&lt;BR /&gt;Month_Availability&lt;BR /&gt;::::::::::::::&lt;BR /&gt;r141DMZ1Month_Availability100.00&lt;BR /&gt;rAriviaLVL.arivia.co.zaMonth_Availability100.00&lt;BR /&gt;rB2B_Africa1Month_Availability100.00&lt;BR /&gt;rCivGermiston1Month_Availability100.00&lt;BR /&gt;rCivHeidelberg1Month_Availability99.53&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It should in fact look like this, but some entries look like tha above with a file name = to the PErsentage &lt;BR /&gt;&lt;BR /&gt;r141DMZ1&lt;BR /&gt;::::::::::::::&lt;BR /&gt;01.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;02.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;03.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;04.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;05.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;06.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;07.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;08.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;08.02.2005r141DMZ110.203.63.6100&lt;BR /&gt;08.02.2005r141DMZ110.203.63.6100</description>
      <pubDate>Thu, 21 Apr 2005 07:05:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/spaces-in-file-causing-problems-with-my-array/m-p/3528511#M701428</guid>
      <dc:creator>Steve_617</dc:creator>
      <dc:date>2005-04-21T07:05:58Z</dc:date>
    </item>
  </channel>
</rss>

