<?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: script to sequence log files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282960#M882373</link>
    <description>Vin,&lt;BR /&gt;&lt;BR /&gt;You might want to look into the Logrotate tool:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/logrotate-2.5/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/logrotate-2.5/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
    <pubDate>Fri, 21 May 2004 05:35:17 GMT</pubDate>
    <dc:creator>Pete Randall</dc:creator>
    <dc:date>2004-05-21T05:35:17Z</dc:date>
    <item>
      <title>script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282959#M882372</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I have a script for sequencing log files from 00 to 59 using:&lt;BR /&gt;&lt;BR /&gt;27  typeset -Z2 N&lt;BR /&gt;&lt;BR /&gt;30  for F in $FILE_LIST&lt;BR /&gt;31  do&lt;BR /&gt;32  (( N=(N+1)%60 ))&lt;BR /&gt;33  mv ${F} $DEST/${N}${F}&lt;BR /&gt;34  done&lt;BR /&gt;&lt;BR /&gt;When I run it however I get the following:&lt;BR /&gt;&lt;BR /&gt;./sequence.sh[32]: 08: The specified number is not valid for this command.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Many thanks.&lt;BR /&gt;</description>
      <pubDate>Fri, 21 May 2004 05:19:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282959#M882372</guid>
      <dc:creator>Vin_4</dc:creator>
      <dc:date>2004-05-21T05:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282960#M882373</link>
      <description>Vin,&lt;BR /&gt;&lt;BR /&gt;You might want to look into the Logrotate tool:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/logrotate-2.5/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/logrotate-2.5/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Fri, 21 May 2004 05:35:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282960#M882373</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2004-05-21T05:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282961#M882374</link>
      <description>This might be the bug that got the posix shell recognizing numbers beginning with 0 as octal.&lt;BR /&gt; &lt;BR /&gt;Try this patch or the latest version of it.&lt;BR /&gt; &lt;BR /&gt;PHCO_29816</description>
      <pubDate>Fri, 21 May 2004 05:46:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282961#M882374</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-05-21T05:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282962#M882375</link>
      <description>Try to change the line :&lt;BR /&gt;&lt;BR /&gt;(( N=(N+1)%60 ))&lt;BR /&gt;&lt;BR /&gt;into :&lt;BR /&gt;&lt;BR /&gt;N=$(( (N+1) % 60 ))&lt;BR /&gt;&lt;BR /&gt;should work...&lt;BR /&gt;</description>
      <pubDate>Fri, 21 May 2004 07:22:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282962#M882375</guid>
      <dc:creator>Juergen Tappe</dc:creator>
      <dc:date>2004-05-21T07:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282963#M882376</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;thanks for replies so far. &lt;BR /&gt;&lt;BR /&gt;Mark, I think you may be right with that, one system was patched 3 weeks ago (script does not work on this system now), works fine on the un-patched systems.&lt;BR /&gt;&lt;BR /&gt;Maybe changing "typeset" could do the job? any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Fri, 21 May 2004 07:29:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282963#M882376</guid>
      <dc:creator>Vin_4</dc:creator>
      <dc:date>2004-05-21T07:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282964#M882377</link>
      <description>well, I guess changing the "typeset" or just not using it at all would prove if it's the "leading zeros are octal" problem.&lt;BR /&gt; &lt;BR /&gt;If you are having problems though, the solution, as is so often the case,  is to simplify.  You could go&lt;BR /&gt; &lt;BR /&gt;(( N=N+1 ))&lt;BR /&gt;[[ $N -gt 60 ]] &amp;amp;&amp;amp; N=0</description>
      <pubDate>Fri, 21 May 2004 07:34:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282964#M882377</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-05-21T07:34:09Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282965#M882378</link>
      <description>Hi There,&lt;BR /&gt;&lt;BR /&gt;This worked for me:&lt;BR /&gt;&lt;BR /&gt;For "(( N=(N+1)%60 ))" i did &lt;BR /&gt;&lt;BR /&gt;let N=$N+1&lt;BR /&gt;let N=$N/60&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 May 2004 07:37:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282965#M882378</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-05-21T07:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282966#M882379</link>
      <description>Hi Mark,&lt;BR /&gt;&lt;BR /&gt;That's nearly what I need, I have to keep the sequence numbers to 2 digits though.&lt;BR /&gt;&lt;BR /&gt;Is there another way to do this?</description>
      <pubDate>Fri, 21 May 2004 07:57:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282966#M882379</guid>
      <dc:creator>Vin_4</dc:creator>
      <dc:date>2004-05-21T07:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282967#M882380</link>
      <description>Vin,&lt;BR /&gt; &lt;BR /&gt;If you want to keep it really simple (and nasty) then add this ugly bit in too&lt;BR /&gt; &lt;BR /&gt;(( N=N+1 ))&lt;BR /&gt;[[ $N -gt 60 ]] &amp;amp;&amp;amp; N=0&lt;BR /&gt;[[ $N -le 10 ]] &amp;amp;&amp;amp; N="0$N"&lt;BR /&gt; &lt;BR /&gt;Horrible isn't it but if you're having problems why not make it ugly but working in my view :)</description>
      <pubDate>Fri, 21 May 2004 08:04:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282967#M882380</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-05-21T08:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282968#M882381</link>
      <description>Back to the same problem with the 'ugly' fix unfortunately&lt;BR /&gt;&lt;BR /&gt;    27  #typeset -Z2 N&lt;BR /&gt;&lt;BR /&gt;    30  for F in $FILE_LIST&lt;BR /&gt;    31  do&lt;BR /&gt;    32  (( N=N+1 ))&lt;BR /&gt;    33  [[ $N -gt 60 ]] &amp;amp;&amp;amp; N=0&lt;BR /&gt;    34  [[ $N -le 10 ]] &amp;amp;&amp;amp; N="0$N"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;./sequence.sh[32]: 09: The specified number is not valid for this command.</description>
      <pubDate>Fri, 21 May 2004 09:29:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282968#M882381</guid>
      <dc:creator>Vin_4</dc:creator>
      <dc:date>2004-05-21T09:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282969#M882382</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I think I have your code working.  I think the trick is around the typeset command and the octal problem mentioned.  I got it to work by using another variable to calculate the number, and then setting the variable N to that number.&lt;BR /&gt;&lt;BR /&gt;Something like this:&lt;BR /&gt;&lt;BR /&gt;typeset -Z2 N&lt;BR /&gt;T=0&lt;BR /&gt;&lt;BR /&gt;for F in $FILE_LIST&lt;BR /&gt;do&lt;BR /&gt;(( T=(T+1)%60 ))&lt;BR /&gt;N=$T&lt;BR /&gt;mv ${F} $DEST/${N}${F}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It looks like your arithmetic expression works, but not with a variable where you have the typeset for -Z2.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 May 2004 09:54:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282969#M882382</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2004-05-21T09:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282970#M882383</link>
      <description>typeset -Z2 N=&lt;VALUE&gt;&lt;BR /&gt;for F in $FILE_LIST&lt;BR /&gt;do&lt;BR /&gt;(( N=N+1 ))&lt;BR /&gt;[[ $N -gt 60 ]] &amp;amp;&amp;amp; N=0&lt;BR /&gt;[[ $N -le 10 ]] &amp;amp;&amp;amp; N="0$N"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope that should work. &lt;BR /&gt;Regards,&lt;/VALUE&gt;</description>
      <pubDate>Fri, 21 May 2004 10:01:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282970#M882383</guid>
      <dc:creator>Bharat Katkar</dc:creator>
      <dc:date>2004-05-21T10:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: script to sequence log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282971#M882384</link>
      <description>That works John, thanks!</description>
      <pubDate>Mon, 24 May 2004 02:43:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-sequence-log-files/m-p/3282971#M882384</guid>
      <dc:creator>Vin_4</dc:creator>
      <dc:date>2004-05-24T02:43:39Z</dc:date>
    </item>
  </channel>
</rss>

