<?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: Awk scripting problem - columns in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854185#M821448</link>
    <description>I have tried the revised script and it works the same&lt;BR /&gt;as the previous one in that it gives the right data in&lt;BR /&gt;the right format except that&lt;BR /&gt;all negative values become positive.&lt;BR /&gt;&lt;BR /&gt;What do you mean when you say &lt;BR /&gt;"given that columns cannot be negative" ?&lt;BR /&gt;&lt;BR /&gt;Is it not possible to have a negative number in the data&lt;BR /&gt;that is still negative once it has gone through the perl&lt;BR /&gt;script ?&lt;BR /&gt;&lt;BR /&gt;Luke</description>
    <pubDate>Wed, 18 Dec 2002 09:57:42 GMT</pubDate>
    <dc:creator>Luke Morgan</dc:creator>
    <dc:date>2002-12-18T09:57:42Z</dc:date>
    <item>
      <title>Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854160#M821423</link>
      <description>Hi,&lt;BR /&gt;I have a data file with a number of records, each with two fields.&lt;BR /&gt;One of the fields is an index number, and the other is a quantity value.&lt;BR /&gt;I need to put the data in a result file that has a large number of&lt;BR /&gt;columns (around 200).&lt;BR /&gt;&lt;BR /&gt;By specifying NF, I can create the number of fields I want in my output&lt;BR /&gt;file, but I need to be able to specify that one of the input&lt;BR /&gt;values corresponds to a column number and insert its quantity value&lt;BR /&gt;in that column.&lt;BR /&gt;&lt;BR /&gt;ie&lt;BR /&gt;data column quantity&lt;BR /&gt; 1 4&lt;BR /&gt; 4 2&lt;BR /&gt;&lt;BR /&gt;would give a result file (using | delimiter)&lt;BR /&gt;4|||2|||&lt;BR /&gt;&lt;BR /&gt;How can I specify the column number using a variable number?&lt;BR /&gt;&lt;BR /&gt;thanks.&lt;BR /&gt;&lt;BR /&gt;Luke</description>
      <pubDate>Thu, 28 Nov 2002 10:44:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854160#M821423</guid>
      <dc:creator>Luke Morgan</dc:creator>
      <dc:date>2002-11-28T10:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854161#M821424</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I am not sure that awk will do what you want but&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://sparky.rice.edu/~hartigan/awk.html" target="_blank"&gt;http://sparky.rice.edu/~hartigan/awk.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;May help your search.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Try an array in a shell script with the array set to "|" in every value and then just fill up&lt;BR /&gt;the variables with number| where relevant.&lt;BR /&gt;&lt;BR /&gt;see man ksh&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;                       Regards&lt;BR /&gt;&lt;BR /&gt;                       Steve Steel&lt;BR /&gt;&lt;BR /&gt;Quote of the moment&lt;BR /&gt;-------------------&lt;BR /&gt;"We are drowning in information but starved for knowledge."&lt;BR /&gt;-- John Naisbitt&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Nov 2002 11:10:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854161#M821424</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2002-11-28T11:10:14Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854162#M821425</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;This one fixes number of columns to greatest index :&lt;BR /&gt;&lt;BR /&gt;#! /usr/bin/sh&lt;BR /&gt;awk '&lt;BR /&gt;BEGIN {&lt;BR /&gt;  max=0&lt;BR /&gt;}&lt;BR /&gt;{&lt;BR /&gt;  t[$1]=$2&lt;BR /&gt;  if (max &amp;lt; $1)&lt;BR /&gt;    max=$1&lt;BR /&gt;}&lt;BR /&gt;END {&lt;BR /&gt;for (i=1 ; i &amp;lt;= max ; i++)&lt;BR /&gt;  if (t[i] == 0)&lt;BR /&gt;    printf("|")&lt;BR /&gt;  else&lt;BR /&gt;    printf("%d|", t[i])&lt;BR /&gt;  print&lt;BR /&gt;}' $1&lt;BR /&gt;&lt;BR /&gt;and this one fixes number of columns as first argument :&lt;BR /&gt;&lt;BR /&gt;#! /usr/bin/sh &lt;BR /&gt;awk -v NB=$1 '&lt;BR /&gt;{&lt;BR /&gt;  t[$1]=$2&lt;BR /&gt;}&lt;BR /&gt;END {&lt;BR /&gt;for (i=1 ; i &amp;lt;= NB ; i++)&lt;BR /&gt;  if (t[i] == 0)&lt;BR /&gt;    printf("|")&lt;BR /&gt;  else&lt;BR /&gt;    printf("%d|", t[i])&lt;BR /&gt;  print&lt;BR /&gt;}' $2&lt;BR /&gt;&lt;BR /&gt;if file contains :&lt;BR /&gt;&lt;BR /&gt;1 4&lt;BR /&gt;4 8&lt;BR /&gt;&lt;BR /&gt;&amp;gt; script1 infile&lt;BR /&gt;4|||8|&lt;BR /&gt;&amp;gt; script2 10 infile&lt;BR /&gt;4|||8|||||||&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 28 Nov 2002 11:19:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854162#M821425</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-11-28T11:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854163#M821426</link>
      <description>Luke,&lt;BR /&gt;&lt;BR /&gt;Not sure if this is what you want, but assuming your output is 20 columns wide:&lt;BR /&gt;&lt;BR /&gt;awk '{a[$1]=$2}END{for (i=1;i&amp;lt;20;i++){printf ("%s|",a[i])};print}' filename&lt;BR /&gt;&lt;BR /&gt;Rgds, Robin</description>
      <pubDate>Thu, 28 Nov 2002 11:19:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854163#M821426</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2002-11-28T11:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854164#M821427</link>
      <description>Hi&lt;BR /&gt;what about this:&lt;BR /&gt;&lt;BR /&gt;awk '{max=10;for (i=1;i&amp;lt;=max;i++)&lt;BR /&gt;        {&lt;BR /&gt;         if ($1==i)&lt;BR /&gt;            { printf("%s|",$2)}&lt;BR /&gt;         else&lt;BR /&gt;            { printf ("|")}&lt;BR /&gt;         if (i==max) printf("\n")&lt;BR /&gt;         }}' file&lt;BR /&gt;&lt;BR /&gt;file looks like that:&lt;BR /&gt;&lt;BR /&gt;1 4&lt;BR /&gt;4 2&lt;BR /&gt;3 3&lt;BR /&gt;2 5&lt;BR /&gt;&lt;BR /&gt;output looks like that:&lt;BR /&gt;&lt;BR /&gt;4||||||||||&lt;BR /&gt;|||2|||||||&lt;BR /&gt;||3||||||||&lt;BR /&gt;|5|||||||||&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Thu, 28 Nov 2002 11:38:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854164#M821427</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-11-28T11:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854165#M821428</link>
      <description>Christian,&lt;BR /&gt;&lt;BR /&gt;That is great, thanks.&lt;BR /&gt;What I really need, is to get all of them on the same output line. (they are unique index numbers)&lt;BR /&gt;&lt;BR /&gt;ie&lt;BR /&gt;instead of &lt;BR /&gt;4|||||||&lt;BR /&gt;|||2||||&lt;BR /&gt;||3|||||&lt;BR /&gt;|5||||||&lt;BR /&gt;&lt;BR /&gt;it reads&lt;BR /&gt;4|5|3|2||||||&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Luke</description>
      <pubDate>Thu, 28 Nov 2002 12:07:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854165#M821428</guid>
      <dc:creator>Luke Morgan</dc:creator>
      <dc:date>2002-11-28T12:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854166#M821429</link>
      <description>Hi Luke,&lt;BR /&gt;&lt;BR /&gt;Using awk:&lt;BR /&gt;&lt;BR /&gt;cat &lt;FILE&gt; | sort -0 +1 -b | awk 'BEGIN {ORS="\|"} {print $2} END {ORS="\n"}' -&lt;BR /&gt;&lt;BR /&gt;I can't guarantee that this version will work, as I don't have access to a unix/linux box at the moment....&lt;BR /&gt;&lt;BR /&gt;Using perl:&lt;BR /&gt;&lt;BR /&gt;perl -wle "open(FILE, $ARGV[0]) || die qq(can't open file); foreach(&lt;FILE&gt;){ ($num,$val) = ($1 - 1,$2) if $_ =~ /^(\d+)\s+(\d+)$/; $fields[$num] = $val; }&lt;BR /&gt;print join('|', @fields)" &lt;FILENAME&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Vincent&lt;/FILENAME&gt;&lt;/FILE&gt;&lt;/FILE&gt;</description>
      <pubDate>Thu, 28 Nov 2002 13:01:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854166#M821429</guid>
      <dc:creator>Vincent Stedema</dc:creator>
      <dc:date>2002-11-28T13:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854167#M821430</link>
      <description>BTW, you might want to ditch the perl "-w" switch so it won't complain about the uninitialized array elements.</description>
      <pubDate>Thu, 28 Nov 2002 13:05:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854167#M821430</guid>
      <dc:creator>Vincent Stedema</dc:creator>
      <dc:date>2002-11-28T13:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854168#M821431</link>
      <description>Hi Luke,&lt;BR /&gt;&lt;BR /&gt;for this input file:&lt;BR /&gt;1 4&lt;BR /&gt;4 2&lt;BR /&gt;6 14&lt;BR /&gt;3 3&lt;BR /&gt;9 23&lt;BR /&gt;2 5&lt;BR /&gt;&lt;BR /&gt;you can get this output:&lt;BR /&gt;|4|5|3|2||14|||23&lt;BR /&gt;&lt;BR /&gt;by running the attached script with the input file as $1&lt;BR /&gt;&lt;BR /&gt;hope it helps,&lt;BR /&gt;John K. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Nov 2002 14:33:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854168#M821431</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2002-11-28T14:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854169#M821432</link>
      <description>And a shorter and simpler version of Vincent's good solution (Vincent, use magic open)&lt;BR /&gt;&lt;BR /&gt;# cat data_file&lt;BR /&gt;1 4&lt;BR /&gt;4 2&lt;BR /&gt;3 3&lt;BR /&gt;2 5&lt;BR /&gt;# perl -nle'/(\d+)\D+(\d+)/ and$x[$1-1]=$2}END{$"="|";print"@x"' data_file&lt;BR /&gt;4|5|3|2&lt;BR /&gt;#</description>
      <pubDate>Thu, 28 Nov 2002 14:42:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854169#M821432</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-11-28T14:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854170#M821433</link>
      <description>Hi&lt;BR /&gt;just for info zhe solution in awk&lt;BR /&gt;&lt;BR /&gt;sort file | awk '{zeile[NR]=$0;maxfield=$1}&lt;BR /&gt;                 END {&lt;BR /&gt;                   run=1&lt;BR /&gt;                   for (i=1;i&amp;lt;=maxfield;i++)&lt;BR /&gt;                     {&lt;BR /&gt;                     split(zeile[run],feld)&lt;BR /&gt;                     if ( i == feld[1])&lt;BR /&gt;                       {&lt;BR /&gt;                         printf("%s|",feld[2])&lt;BR /&gt;                         run++&lt;BR /&gt;                       }&lt;BR /&gt;                     else printf("|")&lt;BR /&gt;                     }&lt;BR /&gt;                 }'&lt;BR /&gt;&lt;BR /&gt;perl is much more elegant than this.&lt;BR /&gt;&lt;BR /&gt;Chris&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Nov 2002 14:52:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854170#M821433</guid>
      <dc:creator>Christian Gebhardt</dc:creator>
      <dc:date>2002-11-28T14:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854171#M821434</link>
      <description>Thank you all very much for your suggestions.&lt;BR /&gt;&lt;BR /&gt;The perl script from procura&lt;BR /&gt;works perfectly although I know&lt;BR /&gt;nothing about perl so I hope I dont have to debug it&lt;BR /&gt;before I get chance to read up! &lt;BR /&gt;:o)&lt;BR /&gt;&lt;BR /&gt;Thanks again&lt;BR /&gt;&lt;BR /&gt;Luke</description>
      <pubDate>Thu, 28 Nov 2002 15:10:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854171#M821434</guid>
      <dc:creator>Luke Morgan</dc:creator>
      <dc:date>2002-11-28T15:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854172#M821435</link>
      <description>can still save three keys on that :)&lt;BR /&gt;&lt;BR /&gt;# perl -nle'/(\d+)\D+(\d+)/and$x[$1-1]=$2}END{$,="|";print@x' data_file&lt;BR /&gt;4|5|3|2&lt;BR /&gt;#</description>
      <pubDate>Thu, 28 Nov 2002 15:11:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854172#M821435</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-11-28T15:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854173#M821436</link>
      <description>using the features you should not, even shorter ...&lt;BR /&gt;&lt;BR /&gt;# perl -nle'/\D+(\d+)/and$x[$`-1]=$1}END{$,="|";print@x' data_file&lt;BR /&gt;4|5|3|2&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;Note that we cannot do&lt;BR /&gt;&lt;BR /&gt;# perl -nle'/\D+/and$x[$`-1]=$'}END{$,="|";print@x' data_file&lt;BR /&gt;&lt;BR /&gt;because $' will end the -e expression&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Nov 2002 15:19:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854173#M821436</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-11-28T15:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854174#M821437</link>
      <description>Is it possible to use that perl script in a loop to do&lt;BR /&gt;a number of datafiles in one go?&lt;BR /&gt;And is it possible to maintain the sign of the numbers?&lt;BR /&gt;ie keep -4 in the data as -4&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;Luke</description>
      <pubDate>Thu, 28 Nov 2002 16:20:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854174#M821437</guid>
      <dc:creator>Luke Morgan</dc:creator>
      <dc:date>2002-11-28T16:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854175#M821438</link>
      <description>Sure, hold on ...&lt;BR /&gt;&lt;BR /&gt;l1:/tmp 110 &amp;gt; perl -le'$,="|";for(@ARGV){open X,"&amp;lt;$_"or die"$_:$!";@x=();while(&lt;X&gt;){/(\d+)\D+?(-?\d+)/and$x[$1-1]=$2}print@x}' data_file1 data_file2&lt;BR /&gt;4|5|3|2&lt;BR /&gt;5|-12|-99|8000&lt;BR /&gt;l1:/tmp 111 &amp;gt; cat data_file1&lt;BR /&gt;1 4&lt;BR /&gt;4 2&lt;BR /&gt;3 3&lt;BR /&gt;2 5&lt;BR /&gt;l1:/tmp 112 &amp;gt; cat data_file2&lt;BR /&gt;3 -99&lt;BR /&gt;1 5&lt;BR /&gt;4 8000&lt;BR /&gt;2 -12&lt;BR /&gt;l1:/tmp 113 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;this what you want?&lt;/X&gt;</description>
      <pubDate>Thu, 28 Nov 2002 17:08:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854175#M821438</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-11-28T17:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854176#M821439</link>
      <description>I tried that on the command line and I got an error:&lt;BR /&gt;&lt;BR /&gt;Modification of non-creatable array value attempted, subscript -1 at -e line 1, &lt;X&gt; line 1.&lt;BR /&gt;&lt;BR /&gt;Unfortunately I don't know a thing about perl so I have no&lt;BR /&gt;idea what the problem is.&lt;BR /&gt;&lt;BR /&gt;The looping I need to do is because I have a directory with&lt;BR /&gt;a number of files in of the same format.  I need to take each&lt;BR /&gt;file and change its format in the way that the first perl script&lt;BR /&gt;you gave me did.&lt;BR /&gt;&lt;BR /&gt;I was thinking a simple script along the lines of &lt;BR /&gt;for a in `ls &lt;DIR&gt;`&lt;BR /&gt;do&lt;BR /&gt;perl&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;I tried this loop using the first script you gave (that works&lt;BR /&gt;perfectly on the command line) and put it into the loop and&lt;BR /&gt;got the same error as the looping perl script...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Luke&lt;/DIR&gt;&lt;/X&gt;</description>
      <pubDate>Fri, 29 Nov 2002 09:08:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854176#M821439</guid>
      <dc:creator>Luke Morgan</dc:creator>
      <dc:date>2002-11-29T09:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854177#M821440</link>
      <description>l1:/tmp 102 &amp;gt; perl5.00503 -le'$,="|";for(@ARGV){open X,"&amp;lt;$_"or die"$_:$!";@x=();while(&lt;X&gt;){/(\d+)\D+?(-?\d+)/and$x[$1-1]=$2}print@x}' data_file1 data_file2&lt;BR /&gt;4|5|3|2&lt;BR /&gt;5|-12|-99|8000&lt;BR /&gt;l1:/tmp 103 &amp;gt; perl5.6.1 -le'$,="|";for(@ARGV){open X,"&amp;lt;$_"or die"$_:$!";@x=();while(&lt;X&gt;){/(\d+)\D+?(-?\d+)/and$x[$1-1]=$2}print@x}' data_file1 data_file2&lt;BR /&gt;4|5|3|2&lt;BR /&gt;5|-12|-99|8000&lt;BR /&gt;l1:/tmp 104 &amp;gt; perl5.8.0 -le'$,="|";for(@ARGV){open X,"&amp;lt;$_"or die"$_:$!";@x=();while(&lt;X&gt;){/(\d+)\D+?(-?\d+)/and$x[$1-1]=$2}print@x}' data_file1 data_file2&lt;BR /&gt;4|5|3|2&lt;BR /&gt;5|-12|-99|8000&lt;BR /&gt;l1:/tmp 105 &amp;gt; perl5.9.0 -le'$,="|";for(@ARGV){open X,"&amp;lt;$_"or die"$_:$!";@x=();while(&lt;X&gt;){/(\d+)\D+?(-?\d+)/and$x[$1-1]=$2}print@x}' data_file1 data_file2&lt;BR /&gt;4|5|3|2&lt;BR /&gt;5|-12|-99|8000&lt;BR /&gt;l1:/tmp 106 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;For a change I realy tested the perl examples I posted. What is your perl version? (perl -v)&lt;BR /&gt;&lt;BR /&gt;Show me the failing script.&lt;/X&gt;&lt;/X&gt;&lt;/X&gt;&lt;/X&gt;</description>
      <pubDate>Fri, 29 Nov 2002 09:46:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854177#M821440</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-11-29T09:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854178#M821441</link>
      <description>Perl version is 5.6.0 for i386-linux.&lt;BR /&gt;&lt;BR /&gt;The simple script Im trying to use to run your perl &lt;BR /&gt;against all the files in the directory is this: &lt;BR /&gt;&lt;BR /&gt;for a in `ls`&lt;BR /&gt;do&lt;BR /&gt;perl -le'$,="|";for(@ARGV){open X,"&amp;lt;$_"or die"$_:$!";@x=();while(&lt;X&gt;){/(\d+)\D+?(-?\d+)/and$x[$1-1]=$2}print@x}' $a &amp;gt; $a.res&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Also, when I run the perl script (its the version 5.6.1 copy from your last post) on the command line, i still get the error about modification of a non-creatable array.&lt;BR /&gt;&lt;BR /&gt;Luke&lt;/X&gt;</description>
      <pubDate>Fri, 29 Nov 2002 10:28:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854178#M821441</guid>
      <dc:creator>Luke Morgan</dc:creator>
      <dc:date>2002-11-29T10:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Awk scripting problem - columns</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854179#M821442</link>
      <description>as I showed that 5.005_03 is good enough, I guess that 5.6.0 is good enough too. Any chance to upgrade to 5.6.1 or 5.8.0? Both are much better than 5.6.0, but that aside.&lt;BR /&gt;&lt;BR /&gt;In the script you show, you /mix/ the all-in-one solution and the one-by-one solution. To play safe, and readable, do:&lt;BR /&gt;&lt;BR /&gt;for a in `ls` ; do&lt;BR /&gt; perl -nle'/(\d+)\D+(\d+)/and$x[$1-1]=$2}END{$,="|";print@x' $a &amp;gt;$a.res&lt;BR /&gt; done&lt;BR /&gt;&lt;BR /&gt;Show me the exact error.&lt;BR /&gt;&lt;BR /&gt;Be careful with my posts at the moment. I'm using the latest Opera 7 beta, which removes even more whitespace than the forum already does :/&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 29 Nov 2002 10:45:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-scripting-problem-columns/m-p/2854179#M821442</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2002-11-29T10:45:58Z</dc:date>
    </item>
  </channel>
</rss>

