<?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: my problems with shell script..awk.. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938395#M762829</link>
    <description>right...thanks..&lt;BR /&gt;&lt;BR /&gt;i think I figured it..thanks for the clue..:)&lt;BR /&gt;&lt;BR /&gt;for file in $(&amp;lt; f.dat); &lt;BR /&gt;do&lt;BR /&gt;        &lt;BR /&gt;&lt;BR /&gt;   awk -F "|" 'NR&amp;gt;1 {print $8;}' /path/$file &amp;gt;&amp;gt; loook&lt;BR /&gt;                       &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I guess that is that... ;)&lt;BR /&gt;&lt;BR /&gt;cheers...and many thanks for prompt assist.</description>
    <pubDate>Mon, 05 Feb 2007 09:16:05 GMT</pubDate>
    <dc:creator>amonamon</dc:creator>
    <dc:date>2007-02-05T09:16:05Z</dc:date>
    <item>
      <title>my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938391#M762825</link>
      <description>Helloo..&lt;BR /&gt;I have directory in which there are 20-30 files..&lt;BR /&gt;I would like to sumarise $12 $13 $14 fiels in each  file but first line in every file needs to be excluded..&lt;BR /&gt;&lt;BR /&gt;here is what I tried:&lt;BR /&gt;dir=/my/files&lt;BR /&gt;ls /path/to &amp;gt; f.dat&lt;BR /&gt;for file in $(&amp;lt; f.dat);&lt;BR /&gt;do&lt;BR /&gt;    sed -e "1,1d" $dir/file &amp;gt;  $dir/file.new&lt;BR /&gt;&lt;BR /&gt;        awk '{print $12'  file.new &amp;gt;&amp;gt; sum&lt;BR /&gt;        awk '{print $13'  file.novi &amp;gt;&amp;gt; sum&lt;BR /&gt;        awk '{print $14'  file.novi &amp;gt;&amp;gt; sum&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;but this is not working as I would like...&lt;BR /&gt;&lt;BR /&gt;thanks in advance..&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2007 08:53:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938391#M762825</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2007-02-05T08:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938392#M762826</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You can cause 'awk' to skip the first record instead of involving a separate filter like 'sed'.&lt;BR /&gt;&lt;BR /&gt;# awk 'NR&amp;gt;1 {X+=$12};END{print X}' file&lt;BR /&gt;&lt;BR /&gt;...would read 'file' but skip the first record and sum all of field-12 into 'X' printing its summation at the end.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 05 Feb 2007 08:58:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938392#M762826</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-02-05T08:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938393#M762827</link>
      <description>thanks...:) did not know that...&lt;BR /&gt;also FS is "|" I forgot to mention...&lt;BR /&gt;&lt;BR /&gt;well..it is not that hard for me to do that for one file..ok it can be done with one awk or as I did for one file with sed and awk...&lt;BR /&gt;&lt;BR /&gt;But what if I have multiple files..in one directory and I need to sum all $12 fields..</description>
      <pubDate>Mon, 05 Feb 2007 09:04:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938393#M762827</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2007-02-05T09:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938394#M762828</link>
      <description>Hi,&lt;BR /&gt;"But what if I have multiple files..in one directory and I need to sum all $12 fields.."&lt;BR /&gt;&lt;BR /&gt;Redirect the sum of each file into an output file (append mode), then sum that file.&lt;BR /&gt;&lt;BR /&gt;James's solution can be used for this again.</description>
      <pubDate>Mon, 05 Feb 2007 09:12:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938394#M762828</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-02-05T09:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938395#M762829</link>
      <description>right...thanks..&lt;BR /&gt;&lt;BR /&gt;i think I figured it..thanks for the clue..:)&lt;BR /&gt;&lt;BR /&gt;for file in $(&amp;lt; f.dat); &lt;BR /&gt;do&lt;BR /&gt;        &lt;BR /&gt;&lt;BR /&gt;   awk -F "|" 'NR&amp;gt;1 {print $8;}' /path/$file &amp;gt;&amp;gt; loook&lt;BR /&gt;                       &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I guess that is that... ;)&lt;BR /&gt;&lt;BR /&gt;cheers...and many thanks for prompt assist.</description>
      <pubDate>Mon, 05 Feb 2007 09:16:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938395#M762829</guid>
      <dc:creator>amonamon</dc:creator>
      <dc:date>2007-02-05T09:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938396#M762830</link>
      <description>awk will be happy to read all files in one go.&lt;BR /&gt;With a minor tweak to JRF's solution that gives:&lt;BR /&gt;&lt;BR /&gt;awk 'NR&amp;gt;1 {X+=$12; Y+=$12; Z+=$14};END{print X "\n" Y "\n" Z}" *&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein</description>
      <pubDate>Mon, 05 Feb 2007 09:25:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938396#M762830</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-05T09:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938397#M762831</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;If you want to sum from multiple files, simply cahnge the NR to FNR.  Thus instead of skipping only the first record (recorded as NR&amp;gt;1 you can skip the first record of each *file* by testing FNR&amp;gt;1.&lt;BR /&gt;&lt;BR /&gt;# awk 'FNR&amp;gt;1 {X+=$3};END{print X}' file1 file2 file3 ...&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 05 Feb 2007 09:30:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938397#M762831</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-02-05T09:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: my problems with shell script..awk..</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938398#M762832</link>
      <description>Hein wrote&amp;gt;&amp;gt; awk 'NR&amp;gt;1 {X+=$12; Y+=$12; Z+=$14};END{print X "\n" Y "\n" Z}" *&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Ooops, I cut &amp;amp; past the wrong line.&lt;BR /&gt;Make that:&lt;BR /&gt;&lt;BR /&gt;awk 'FNR&amp;gt;1 {X+=$12; Y+=$12; Z+=$14};END{print X "\n" Y "\n" Z}' *&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 05 Feb 2007 09:38:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/my-problems-with-shell-script-awk/m-p/3938398#M762832</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-05T09:38:30Z</dc:date>
    </item>
  </channel>
</rss>

