<?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: UNIX scripting &amp;amp; Storage methods in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846769#M92397</link>
    <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply, I am not too concerned with what the output would be like, just obtaining the value and being able to create this temporary storage area containing distinct values that I can count would be ideal. If it helps, just writing to any file with the distinct number count would be useful.&lt;BR /&gt;&lt;BR /&gt;What I will do for the end result, is overwrite an erroneous value ie.&lt;BR /&gt;&lt;BR /&gt;the wrong file footer (Only two distinct value (1 &amp;amp; 2) but the footer says 3):&lt;BR /&gt;&lt;BR /&gt;|header|&lt;BR /&gt;|1|a|b&lt;BR /&gt;|1|a|&lt;BR /&gt;|2|a|b|c|d|&lt;BR /&gt;|footer|3|&lt;BR /&gt;&lt;BR /&gt;would be overwritten using awk, to :&lt;BR /&gt;&lt;BR /&gt;|header|&lt;BR /&gt;|1|a|b&lt;BR /&gt;|1|a|&lt;BR /&gt;|2|a|b|c|d|&lt;BR /&gt;|footer|2|&lt;BR /&gt;&lt;BR /&gt;Which, I can manage OK&lt;BR /&gt;&lt;BR /&gt;thanks again&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 18 Nov 2002 11:39:46 GMT</pubDate>
    <dc:creator>u856100</dc:creator>
    <dc:date>2002-11-18T11:39:46Z</dc:date>
    <item>
      <title>UNIX scripting &amp; Storage methods</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846767#M92395</link>
      <description>People,&lt;BR /&gt;&lt;BR /&gt;I am trying to store the occurence of a particular field in a file into something like a vector. I want to store each distinct occurence of the value, and then search the vector to do a count of the number of entries.&lt;BR /&gt;&lt;BR /&gt;for example, I have a load of files that have entries like the following :&lt;BR /&gt;&lt;BR /&gt;|header file|&lt;BR /&gt;|1|a|b|c|d|&lt;BR /&gt;|1|a|b|c|&lt;BR /&gt;|2|a|b|c|d|e|&lt;BR /&gt;|1|a|b|&lt;BR /&gt;|footer|2|&lt;BR /&gt;&lt;BR /&gt;where the value "2" in the footer file is the distinct number of 'numeric types' that exist in the first pipe delimited field of each row. So if the file was as follows : &lt;BR /&gt;&lt;BR /&gt;|header file|&lt;BR /&gt;|1|a|b|c|d|&lt;BR /&gt;|2|a|b|c|&lt;BR /&gt;|3|a|b|c|d|e|&lt;BR /&gt;|1|a|b|&lt;BR /&gt;|footer|3|&lt;BR /&gt;&lt;BR /&gt;The footer shows 3 types (hope this makes sense).&lt;BR /&gt;&lt;BR /&gt;what I would like to do is store each numeric type and then, as I progress through the file rows, increment a count each time a new distinct value occurs. I will need this value to stick in a file at the end of the file traversal.&lt;BR /&gt;&lt;BR /&gt;I am not too familiar with UNIX scripting as I am a java programmer (and hence very familiar with vectors, etc), so I don't even know whether vectors exist in posix shell scripting.&lt;BR /&gt;&lt;BR /&gt;thanks in advance people&lt;BR /&gt;John</description>
      <pubDate>Mon, 18 Nov 2002 10:41:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846767#M92395</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-11-18T10:41:56Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX scripting &amp; Storage methods</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846768#M92396</link>
      <description>it may be useful if you post up what you'd like the result file to look like.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Nov 2002 10:55:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846768#M92396</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2002-11-18T10:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX scripting &amp; Storage methods</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846769#M92397</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply, I am not too concerned with what the output would be like, just obtaining the value and being able to create this temporary storage area containing distinct values that I can count would be ideal. If it helps, just writing to any file with the distinct number count would be useful.&lt;BR /&gt;&lt;BR /&gt;What I will do for the end result, is overwrite an erroneous value ie.&lt;BR /&gt;&lt;BR /&gt;the wrong file footer (Only two distinct value (1 &amp;amp; 2) but the footer says 3):&lt;BR /&gt;&lt;BR /&gt;|header|&lt;BR /&gt;|1|a|b&lt;BR /&gt;|1|a|&lt;BR /&gt;|2|a|b|c|d|&lt;BR /&gt;|footer|3|&lt;BR /&gt;&lt;BR /&gt;would be overwritten using awk, to :&lt;BR /&gt;&lt;BR /&gt;|header|&lt;BR /&gt;|1|a|b&lt;BR /&gt;|1|a|&lt;BR /&gt;|2|a|b|c|d|&lt;BR /&gt;|footer|2|&lt;BR /&gt;&lt;BR /&gt;Which, I can manage OK&lt;BR /&gt;&lt;BR /&gt;thanks again&lt;BR /&gt;John&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 18 Nov 2002 11:39:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846769#M92397</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-11-18T11:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX scripting &amp; Storage methods</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846770#M92398</link>
      <description>Why not do it in java? perl and awk can also do this.&lt;BR /&gt;&lt;BR /&gt;live free or die&lt;BR /&gt;harry</description>
      <pubDate>Mon, 18 Nov 2002 12:18:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846770#M92398</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2002-11-18T12:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX scripting &amp; Storage methods</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846771#M92399</link>
      <description>Heelo again Bill,&lt;BR /&gt;&lt;BR /&gt;Could you give me an example of how awk does this.&lt;BR /&gt;&lt;BR /&gt;I have not done it in Java because the function I am trying to create is a smaller part of a much bigger script that uses a korn script. I am just trying to keep things simple and neat.&lt;BR /&gt;&lt;BR /&gt;thanks again&lt;BR /&gt;John</description>
      <pubDate>Mon, 18 Nov 2002 12:29:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846771#M92399</guid>
      <dc:creator>u856100</dc:creator>
      <dc:date>2002-11-18T12:29:52Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX scripting &amp; Storage methods</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846772#M92400</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try this script :&lt;BR /&gt;&lt;BR /&gt;cat file | awk -F'|' '&lt;BR /&gt;/^|header\|$/{&lt;BR /&gt;  getline&lt;BR /&gt;  print&lt;BR /&gt;  getline&lt;BR /&gt;  nb=0&lt;BR /&gt;  max=0&lt;BR /&gt;  while ($2 != "footer")&lt;BR /&gt;  {&lt;BR /&gt;    print&lt;BR /&gt;    if (a[$2] != 1)&lt;BR /&gt;    {&lt;BR /&gt;      a[$2]=1&lt;BR /&gt;      nb++&lt;BR /&gt;      if (nb &amp;gt; max)&lt;BR /&gt;        max=nb&lt;BR /&gt;    }&lt;BR /&gt;    getline&lt;BR /&gt;  }&lt;BR /&gt;  printf("|footer|%d|\n", nb)&lt;BR /&gt;  for (i=0;i&amp;lt;=max;i++)&lt;BR /&gt;    a[i]=0&lt;BR /&gt;}'&lt;BR /&gt;&lt;BR /&gt;If input file is :&lt;BR /&gt;&lt;BR /&gt;|header| &lt;BR /&gt;|1|a|b &lt;BR /&gt;|1|a| &lt;BR /&gt;|2|a|b|c|d| &lt;BR /&gt;|footer|3|&lt;BR /&gt;|header| &lt;BR /&gt;|1|a|b &lt;BR /&gt;|3|a| &lt;BR /&gt;|2|a|b|c|d| &lt;BR /&gt;|footer|3|&lt;BR /&gt;&lt;BR /&gt;Output file will be :&lt;BR /&gt;&lt;BR /&gt;|header| &lt;BR /&gt;|1|a|b &lt;BR /&gt;|1|a| &lt;BR /&gt;|2|a|b|c|d| &lt;BR /&gt;|footer|2|&lt;BR /&gt;|header| &lt;BR /&gt;|1|a|b &lt;BR /&gt;|3|a| &lt;BR /&gt;|2|a|b|c|d| &lt;BR /&gt;|footer|3|</description>
      <pubDate>Mon, 18 Nov 2002 12:51:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/unix-scripting-amp-storage-methods/m-p/2846772#M92400</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2002-11-18T12:51:00Z</dc:date>
    </item>
  </channel>
</rss>

