<?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: Caluclations in script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924426#M816259</link>
    <description>Have a look at the arithmetic evaluation section in the manpage of sh-posix.&lt;BR /&gt;Bear in mind that the shell's arithmetic capabilities are however somewhat restricted&lt;BR /&gt;(compared to most scripting or programming languages, or programs such as bc)&lt;BR /&gt;The manpage will tell you.&lt;BR /&gt;Nevertheless you can define shell variables to be treated as integers explicitly by the typeset built-in.&lt;BR /&gt;Variables marked such can easily be evaluated in double parentheses.&lt;BR /&gt;  &lt;BR /&gt;e.g.&lt;BR /&gt;   &lt;BR /&gt; &lt;BR /&gt;$ typeset -i line_no=0; while read line; do printf "%0.4d\n" $((line_no+=1));done &amp;lt; /etc/hosts|tail&lt;BR /&gt;0049&lt;BR /&gt;0050&lt;BR /&gt;0051&lt;BR /&gt;0052&lt;BR /&gt;0053&lt;BR /&gt;0054&lt;BR /&gt;0055&lt;BR /&gt;0056&lt;BR /&gt;0057&lt;BR /&gt;0058&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;If you were using a Perl script you could refer to the special package global $.&lt;BR /&gt;which holds the current line number&lt;BR /&gt;(see "perldoc perlvar" for further explanations)&lt;BR /&gt;</description>
    <pubDate>Thu, 08 Sep 2005 03:12:15 GMT</pubDate>
    <dc:creator>Ralph Grothe</dc:creator>
    <dc:date>2005-09-08T03:12:15Z</dc:date>
    <item>
      <title>Caluclations in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924424#M816257</link>
      <description>My problem&lt;BR /&gt;&lt;BR /&gt;  i have some xml files whcih i'm intersted to convert in to a execl file and merge it.&lt;BR /&gt;&lt;BR /&gt;  i have planned to convert amd merge more then 25 files to sigle large file with a tab space so that i will be able to view as a exel file.&lt;BR /&gt;&lt;BR /&gt;  but each and every xml file is different from other so i cant use simple cat head and tail cmd.&lt;BR /&gt;&lt;BR /&gt;  now i'm thinking of using line numbers.&lt;BR /&gt;&lt;BR /&gt;Need Solution&lt;BR /&gt;&lt;BR /&gt;  for this i want to do some calculations in the script i want my script to add $TT with 141&lt;BR /&gt;where $TT will be changing how to do this.&lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Thu, 08 Sep 2005 02:11:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924424#M816257</guid>
      <dc:creator>jayachandran.g</dc:creator>
      <dc:date>2005-09-08T02:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Caluclations in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924425#M816258</link>
      <description>First, be aware that shell calculations are limited to integer values. so sticking it to shell arithmatic is not a good idea.&lt;BR /&gt;&lt;BR /&gt;you can do it as follows.&lt;BR /&gt;&lt;BR /&gt;total=$(($TT+2))&lt;BR /&gt;&lt;BR /&gt;Better way to do it, is with bc/bs&lt;BR /&gt;&lt;BR /&gt;echo "$TT+96" | bc&lt;BR /&gt;echo "$TT+96" | bs</description>
      <pubDate>Thu, 08 Sep 2005 02:17:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924425#M816258</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2005-09-08T02:17:42Z</dc:date>
    </item>
    <item>
      <title>Re: Caluclations in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924426#M816259</link>
      <description>Have a look at the arithmetic evaluation section in the manpage of sh-posix.&lt;BR /&gt;Bear in mind that the shell's arithmetic capabilities are however somewhat restricted&lt;BR /&gt;(compared to most scripting or programming languages, or programs such as bc)&lt;BR /&gt;The manpage will tell you.&lt;BR /&gt;Nevertheless you can define shell variables to be treated as integers explicitly by the typeset built-in.&lt;BR /&gt;Variables marked such can easily be evaluated in double parentheses.&lt;BR /&gt;  &lt;BR /&gt;e.g.&lt;BR /&gt;   &lt;BR /&gt; &lt;BR /&gt;$ typeset -i line_no=0; while read line; do printf "%0.4d\n" $((line_no+=1));done &amp;lt; /etc/hosts|tail&lt;BR /&gt;0049&lt;BR /&gt;0050&lt;BR /&gt;0051&lt;BR /&gt;0052&lt;BR /&gt;0053&lt;BR /&gt;0054&lt;BR /&gt;0055&lt;BR /&gt;0056&lt;BR /&gt;0057&lt;BR /&gt;0058&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;If you were using a Perl script you could refer to the special package global $.&lt;BR /&gt;which holds the current line number&lt;BR /&gt;(see "perldoc perlvar" for further explanations)&lt;BR /&gt;</description>
      <pubDate>Thu, 08 Sep 2005 03:12:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924426#M816259</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2005-09-08T03:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Caluclations in script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924427#M816260</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;  Thanks for your reply.&lt;BR /&gt;&lt;BR /&gt; As if i'm going to use only addition not more than 3 digits i hope the answer you people provided will do.&lt;BR /&gt;&lt;BR /&gt; Thank You.&lt;BR /&gt;And i'm using the procedure give by RAC as if that is very easy one to follow.</description>
      <pubDate>Thu, 08 Sep 2005 10:13:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/caluclations-in-script/m-p/4924427#M816260</guid>
      <dc:creator>jayachandran.g</dc:creator>
      <dc:date>2005-09-08T10:13:53Z</dc:date>
    </item>
  </channel>
</rss>

