<?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: calculate days between two dates in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897182#M104201</link>
    <description>Thanks to Armin, Chris, Tom &amp;amp; John .....&lt;BR /&gt;&lt;BR /&gt;I've tested with John's script and it's good ... but John, my file names are not fixed in length .... the file name format is *Date.log .....&lt;BR /&gt;&lt;BR /&gt;see the output below :&lt;BR /&gt;fuji#  ll |grep ".log$" |awk '{print $NF}'&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002134438.log&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002153119.log&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150024.log&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150040.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003141625.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142218.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142341.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003150420.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151043.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151433.log&lt;BR /&gt;ftp_recovery10Jan2003200423.log&lt;BR /&gt;ftp_recovery10Jan2003201529.log&lt;BR /&gt;ftp_recovery13Jan2003190819.log&lt;BR /&gt;ftp_recovery13Jan2003190951.log&lt;BR /&gt;ftp_recovery13Jan2003191048.log&lt;BR /&gt;ftp_recovery13Jan2003191507.log&lt;BR /&gt;ftp_recovery13Jan2003192100.log&lt;BR /&gt;fuji#&lt;BR /&gt;&lt;BR /&gt;I think i need to change John's script to fetch time details by subtracting from the end ....&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-bala-&lt;BR /&gt;</description>
    <pubDate>Thu, 06 Feb 2003 02:31:36 GMT</pubDate>
    <dc:creator>Bala_8</dc:creator>
    <dc:date>2003-02-06T02:31:36Z</dc:date>
    <item>
      <title>calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897176#M104195</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have some logfiles being generated thru various batch processes. The file names include the date,time of generation of the logfile. A sample listing is shown below :&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;fuji# ll&lt;BR /&gt;total 836&lt;BR /&gt;-rw-r-----   1 wladm      services    398079 Dec 23  2002 BIWPSLB001fBatchLog&lt;BR /&gt;-rw-r-----   1 wladm      services      1696 Dec 30  2002 biwpsnss005m.iwps.int30Dec2002134438.log&lt;BR /&gt;-rw-r-----   1 wladm      services      1696 Dec 30  2002 biwpsnss005m.iwps.int30Dec2002153119.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       409 Jan 17  2003 BIWPSQO002mBatchLog&lt;BR /&gt;-rw-r--r--   1 wladm      services       907 Jan  9  2003 biwpssp004d.iwps.ext09Jan2003150024.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       907 Jan  9  2003 biwpssp004d.iwps.ext09Jan2003150040.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       887 Jan  9  2003 biwpswa007d.iwps.int09Jan2003141625.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       887 Jan  9  2003 biwpswa007d.iwps.int09Jan2003142218.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       887 Jan  9  2003 biwpswa007d.iwps.int09Jan2003142341.log&lt;BR /&gt;-rw-r--r--   1 wladm      services      1242 Jan  9  2003 biwpswa007d.iwps.int09Jan2003150420.log&lt;BR /&gt;-rw-r--r--   1 wladm      services      1242 Jan  9  2003 biwpswa007d.iwps.int09Jan2003151043.log&lt;BR /&gt;-rw-r--r--   1 wladm      services      5679 Jan  9  2003 biwpswa007d.iwps.int09Jan2003151433.log&lt;BR /&gt;-rw-r--r--   1 wladm      services      1347 Jan 10  2003 ftp_recovery10Jan2003200423.log&lt;BR /&gt;-rw-r--r--   1 wladm      services      1343 Jan 10  2003 ftp_recovery10Jan2003201529.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       321 Jan 13  2003 ftp_recovery13Jan2003190819.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       321 Jan 13  2003 ftp_recovery13Jan2003190951.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       318 Jan 13  2003 ftp_recovery13Jan2003191048.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       318 Jan 13  2003 ftp_recovery13Jan2003191507.log&lt;BR /&gt;-rw-r--r--   1 wladm      services       321 Jan 13  2003 ftp_recovery13Jan2003192100.log&lt;BR /&gt;-------------------------------------------&lt;BR /&gt;&lt;BR /&gt;I need help in writing a script which compares the date string within the file names, of all files in /abc/log directory, with the current system date. If the difference is 14 days or more, i need to delete that file from this directory. Since i've backup of these logfiles in tape, i need to clear from the system to free up space. This script will be scheduled to run daily.&lt;BR /&gt;&lt;BR /&gt;Looking forward for all your valuable feedbacks / suggestions.&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-bala-</description>
      <pubDate>Wed, 05 Feb 2003 10:57:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897176#M104195</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-05T10:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897177#M104196</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;please have a look at this:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x2b9f85079106d71190050090279cd0f9,00.html" target="_blank"&gt;http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x2b9f85079106d71190050090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope that helps.&lt;BR /&gt;&lt;BR /&gt;Regards ...&lt;BR /&gt;Armin</description>
      <pubDate>Wed, 05 Feb 2003 11:01:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897177#M104196</guid>
      <dc:creator>Armin Feller</dc:creator>
      <dc:date>2003-02-05T11:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897178#M104197</link>
      <description>in that directory&lt;BR /&gt;&lt;BR /&gt;find . -name "*.log" -mtime +14 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Any log file over 14 days old will then be deleted.</description>
      <pubDate>Wed, 05 Feb 2003 11:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897178#M104197</guid>
      <dc:creator>Chris Wilshaw</dc:creator>
      <dc:date>2003-02-05T11:10:31Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897179#M104198</link>
      <description>But Chris,&lt;BR /&gt;&lt;BR /&gt;I want to use the time stamp within the file name, due to some reasons.&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;-bala-</description>
      <pubDate>Wed, 05 Feb 2003 11:23:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897179#M104198</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-05T11:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897180#M104199</link>
      <description>Hi Bala:&lt;BR /&gt;&lt;BR /&gt;I've done something like this in C.  You may want to do some printf statements to show the results.  Sorry about the formatting. &lt;BR /&gt;&lt;BR /&gt;Tom&lt;BR /&gt;&lt;BR /&gt;/* includes */&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;DIRENT.H&gt;&lt;BR /&gt;#include &lt;TIME.H&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;&lt;BR /&gt;#define RETENTION 10&lt;BR /&gt;&lt;BR /&gt;main( argc, argv, envp )&lt;BR /&gt;int   argc;&lt;BR /&gt;char *argv[];&lt;BR /&gt;char *envp[];&lt;BR /&gt;{&lt;BR /&gt;int cur_date;&lt;BR /&gt;int file_date;&lt;BR /&gt;char today[BUFSIZ];&lt;BR /&gt;char file_date_ascii[BUFSIZ];&lt;BR /&gt;char string[BUFSIZ];&lt;BR /&gt;DIR *dir;&lt;BR /&gt;time_t t;&lt;BR /&gt;struct stat file_status;&lt;BR /&gt;struct dirent *ent;&lt;BR /&gt;struct tm *sys_date;&lt;BR /&gt;struct tm *file_date_st;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;t = time(NULL);&lt;BR /&gt;sys_date = localtime(&amp;amp;t);&lt;BR /&gt;cur_date = sys_date-&amp;gt;tm_yday;&lt;BR /&gt;cur_date = sys_date-&amp;gt;tm_yday;&lt;BR /&gt;strcpy(today, asctime(sys_date));&lt;BR /&gt;today[strlen(today)-1] = '\0';&lt;BR /&gt;&lt;BR /&gt;chdir("/some/dir/somewhere");&lt;BR /&gt;&lt;BR /&gt;dir = opendir("/some/dir/somewhere");&lt;BR /&gt;while ((ent = readdir(dir)) != NULL)&lt;BR /&gt; {&lt;BR /&gt; sprintf(string, "%s/%s", ent-&amp;gt;d_name, "someFile.*");&lt;BR /&gt; if (!stat(string, &amp;amp;file_status))&lt;BR /&gt;  {&lt;BR /&gt;  file_date_st = localtime(&amp;amp;file_status.st_atime);&lt;BR /&gt;  file_date = file_date_st-&amp;gt;tm_yday;&lt;BR /&gt;  if (file_date &amp;gt; cur_date)&lt;BR /&gt;   {&lt;BR /&gt;   if (file_date &amp;lt; cur_date+365-RETENTION)&lt;BR /&gt;    {&lt;BR /&gt;    do something ...&lt;BR /&gt;    }&lt;BR /&gt;   else&lt;BR /&gt;    {&lt;BR /&gt;    do something else&lt;BR /&gt;    }&lt;BR /&gt;   }&lt;BR /&gt;  }&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;&lt;/SYS&gt;&lt;/TIME.H&gt;&lt;/DIRENT.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Wed, 05 Feb 2003 12:18:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897180#M104199</guid>
      <dc:creator>Tom Jackson</dc:creator>
      <dc:date>2003-02-05T12:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897181#M104200</link>
      <description>Hi Bala,&lt;BR /&gt;please try the following script, but first configure  RETURN_SECS_SCRIPT to point at the attached script.&lt;BR /&gt;LOGDIR must point to the directory where your logfiles are located.&lt;BR /&gt;FILE_AGE is currently set to 1209600, which is 14 days expressed in seconds - can be changed for test purposes. the rm command has been commented out.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;RETURN_SECS_SCRIPT=""&lt;BR /&gt;FILE_AGE="1209600"     # no. of seconds&lt;BR /&gt;LOGDIR="" # location of logfiles&lt;BR /&gt;FILE_NAME=""&lt;BR /&gt;typeset -i LENGTH=0&lt;BR /&gt;&lt;BR /&gt;# Secs since 1970&lt;BR /&gt;CURRENT_TIME=`$RETURN_SECS_SCRIPT`&lt;BR /&gt;&lt;BR /&gt;ll ${LOGDIR} | while read line&lt;BR /&gt;do&lt;BR /&gt;        FILE_NAME=`echo "$line"| awk '{print $NF}'| grep ".log$"`&lt;BR /&gt;        # Length of filename&lt;BR /&gt;        LENGTH="${#FILE_NAME}"&lt;BR /&gt;        if [ "$LENGTH" -gt 0 ]&lt;BR /&gt;        then&lt;BR /&gt;                # Extract timespecs from filename&lt;BR /&gt;                FILE_DAY=`echo $FILE_NAME | cut -c $(( $LENGTH - 18 ))-$(( $LENG&lt;BR /&gt;TH - 17 ))`&lt;BR /&gt;               FILE_MONTH=`echo $FILE_NAME | cut -c $(( $LENGTH - 16 ))-$(( $LE&lt;BR /&gt;NGTH - 14))`&lt;BR /&gt;                FILE_YEAR=`echo $FILE_NAME | cut -c $(( $LENGTH - 13 ))-$(( $LEN&lt;BR /&gt;GTH - 10))`&lt;BR /&gt;                FILE_HOUR=`echo $FILE_NAME | cut -c $(( $LENGTH - 9 ))-$(( $LENG&lt;BR /&gt;TH - 8 ))`&lt;BR /&gt;                FILE_MINUTE=`echo $FILE_NAME | cut -c $(( $LENGTH - 7 ))-$(( $LE&lt;BR /&gt;NGTH - 6 ))`&lt;BR /&gt;                FILE_SECOND=`echo $FILE_NAME | cut -c $(( $LENGTH - 5 ))-$(( $LE&lt;BR /&gt;NGTH - 4 ))`&lt;BR /&gt;                # How old is file..&lt;BR /&gt;                FILE_TIME_STAMP=`$RETURN_SECS_SCRIPT 1970 $FILE_YEAR $FILE_MONTH&lt;BR /&gt; $FILE_DAY $FILE_HOUR $FILE_MINUTE $FILE_SECOND`&lt;BR /&gt;                # How old is file in secs since now?&lt;BR /&gt;                DIFFERENCE=$(( $CURRENT_TIME  - $FILE_TIME_STAMP ))&lt;BR /&gt;                # Is that above limit?&lt;BR /&gt;                if [ "$DIFFERENCE" -gt "$FILE_AGE" ]&lt;BR /&gt;                then&lt;BR /&gt;                        echo $FILE_NAME is to be removed&lt;BR /&gt;                        # rm $FILE_NAME&lt;BR /&gt;                else&lt;BR /&gt;                        echo $FILE_NAME is not old enough&lt;BR /&gt;                fi&lt;BR /&gt;        fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;# End of script&lt;BR /&gt;Sorry about the missing indentions.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Feb 2003 14:21:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897181#M104200</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-05T14:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897182#M104201</link>
      <description>Thanks to Armin, Chris, Tom &amp;amp; John .....&lt;BR /&gt;&lt;BR /&gt;I've tested with John's script and it's good ... but John, my file names are not fixed in length .... the file name format is *Date.log .....&lt;BR /&gt;&lt;BR /&gt;see the output below :&lt;BR /&gt;fuji#  ll |grep ".log$" |awk '{print $NF}'&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002134438.log&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002153119.log&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150024.log&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150040.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003141625.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142218.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142341.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003150420.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151043.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151433.log&lt;BR /&gt;ftp_recovery10Jan2003200423.log&lt;BR /&gt;ftp_recovery10Jan2003201529.log&lt;BR /&gt;ftp_recovery13Jan2003190819.log&lt;BR /&gt;ftp_recovery13Jan2003190951.log&lt;BR /&gt;ftp_recovery13Jan2003191048.log&lt;BR /&gt;ftp_recovery13Jan2003191507.log&lt;BR /&gt;ftp_recovery13Jan2003192100.log&lt;BR /&gt;fuji#&lt;BR /&gt;&lt;BR /&gt;I think i need to change John's script to fetch time details by subtracting from the end ....&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-bala-&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 02:31:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897182#M104201</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-06T02:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897183#M104202</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;ignore the previous contents ...&lt;BR /&gt;&lt;BR /&gt;I get error in retun_seconds.sh while doing (09 - 1) .. ie ., the date is 09 or month is 09 ....&lt;BR /&gt;&lt;BR /&gt;i suspect it occurs while doing &lt;BR /&gt;&lt;BR /&gt;# Adjust entered time specs acc. to&lt;BR /&gt;# match date conventions.&lt;BR /&gt;#&lt;BR /&gt;# Subtract last month&lt;BR /&gt;#&lt;BR /&gt;MONTH=$(( $MONTH - 1 ));&lt;BR /&gt;#&lt;BR /&gt;# Subtract one day&lt;BR /&gt;#&lt;BR /&gt;DAY=$(( $DAY - 1 ))&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;in return_seconds.sh .....&lt;BR /&gt;&lt;BR /&gt;The error message i receive is as  below:&lt;BR /&gt;&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002134438.log is not old enough&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002153119.log is not old enough&lt;BR /&gt;/tmp/script/return_seconds.sh[215]: 09 - 1 : The specified number is not valid for this command.&lt;BR /&gt;./log_retention.sh[30]:  7989910 -  : Expression is not complete; more tokens expected.&lt;BR /&gt;&lt;BR /&gt;How to resolve this ???&lt;BR /&gt;Thanks in advance...&lt;BR /&gt;&lt;BR /&gt;-bala-</description>
      <pubDate>Thu, 06 Feb 2003 03:39:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897183#M104202</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-06T03:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897184#M104203</link>
      <description>Hi again Bala,&lt;BR /&gt;I have tried to reproduce the error on my system, using these file names:&lt;BR /&gt;BIWPSLB001fBatchLog&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002134438.log&lt;BR /&gt;BIWPSQO002mBatchLog&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150024.log&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150040.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003141625.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142218.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142341.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003150420.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151043.log&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151433.log&lt;BR /&gt;ftp_recovery10Jan2003200423.log&lt;BR /&gt;ftp_recovery10Jan2003201529.log&lt;BR /&gt;ftp_recovery13Jan2003190951.log&lt;BR /&gt;ftp_recovery13Jan2003191048.log&lt;BR /&gt;ftp_recovery13Jan2003191507.log&lt;BR /&gt;ftp_recovery13Jan2003192100.log&lt;BR /&gt;&lt;BR /&gt;and I get this result:&lt;BR /&gt;&lt;BR /&gt;biwpsnss005m.iwps.int30Dec2002134438.log is to be removed&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150024.log is to be removed&lt;BR /&gt;biwpssp004d.iwps.ext09Jan2003150040.log is to be removed&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003141625.log is to be removed&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142218.log is to be removed&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003142341.log is to be removed&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003150420.log is to be removed&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151043.log is to be removed&lt;BR /&gt;biwpswa007d.iwps.int09Jan2003151433.log is to be removed&lt;BR /&gt;ftp_recovery10Jan2003200423.log is to be removed&lt;BR /&gt;ftp_recovery10Jan2003201529.log is to be removed&lt;BR /&gt;ftp_recovery13Jan2003190951.log is not old enough&lt;BR /&gt;ftp_recovery13Jan2003191048.log is not old enough&lt;BR /&gt;ftp_recovery13Jan2003191507.log is not old enough&lt;BR /&gt;ftp_recovery13Jan2003192100.log is not old enough&lt;BR /&gt;&lt;BR /&gt;i.e. "we could not reproduce the error on our system" - you have probably heard that before. But try running the return_seconds.sh on the command line, e.g.:&lt;BR /&gt;# &lt;BR /&gt;./return_seconds.sh 1970 2003 09 09 09 09 09&lt;BR /&gt;On my system it returns&lt;BR /&gt;1063098549&lt;BR /&gt;&lt;BR /&gt;I cannot quite figure out what has caused the error, apart from the obvious that  the script did not like the input. The return_seconds.sh does not check on any input as it is slow enough already. However, it only supports month names in English and Danish, e.g. for month no. 9 it accecps only the string "Sep" or "09" or "9", e.g.:&lt;BR /&gt;       Sep|9|09) echo 9;;&lt;BR /&gt;Could that be the problem? How does month no. 9 appear in the file name causing the problem? Could you post the file name that causes the error? &lt;BR /&gt;I do not know when you have time for reading this, but in 22 hours from now I shall be on my way to Norway, skiing  all of next week. It might therefore take a while before I can look into this again.  &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 08:39:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897184#M104203</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-06T08:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897185#M104204</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;It occurs in date field .... &lt;BR /&gt;Exactly on the files created on *09Jan2003* ...&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;-bala-&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 10:28:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897185#M104204</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-06T10:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897186#M104205</link>
      <description>Hi John,&lt;BR /&gt;&lt;BR /&gt;i edited your script to replace REFERENCE_YEAR to 2002 instead of 1970 .... i also made the same change in the main script to set the BASE YEAR as 2002.&lt;BR /&gt;&lt;BR /&gt;The first two files contains 2002 timestamp, so they passed the test... but the third file onwards the timestamp is 2003 ....&lt;BR /&gt;&lt;BR /&gt;For your info,&lt;BR /&gt;For some reasons our system date is set back to March 2002 and the current system date is 03/April/2002 .....&lt;BR /&gt;&lt;BR /&gt;Will it cause any problems ???&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-bala-&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 10:35:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897186#M104205</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-06T10:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897187#M104206</link>
      <description>Hi Bala,&lt;BR /&gt;changing the REFERENCE_YEAR should not make a big difference; the parameter only specifies to which year return_seconds.sh should count back; it should actually increase speed.&lt;BR /&gt;When executed without parameters, return_seconds.sh will then count back from April 3rd 2002 till midnight 1/1-2002. I had actually assumed that your system's date was past the date expressed in the file names, which it apparently is not! Your system's timesetting will  cause a negative value when subtracting the number of seconds specified in the file names, from the number of seconds of your system's curent time. However, I do not think that the problem is there. Try executing  return_seconds.sh with the parameters similar to those it gets from the file names causing the problem, in order to see which causes the  crash. It should be something like:&lt;BR /&gt;# return_seconds.sh 1970 2003 Jan 09 15 14 33&lt;BR /&gt;As mentioned, I am not able to reproduce the error here. Can you reproduce it on another machine?&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 11:30:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897187#M104206</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-06T11:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897188#M104207</link>
      <description>Hi Bala,&lt;BR /&gt;I think that I know what is wrong, but as I am just about leaving, I do not have time to search for the full solution.  Anyway, I am convinced that the problem is that on your system the number "09" inside the  $(( )) is regarded by the shell to be a hexadecimal number.&lt;BR /&gt;If your system is a 11.00 and perhaps you should have  patch PHCO_26789 installed; there may be other patches for this problem as well. If that is not the case, then search the forum for solutions to the "shell   believes 09 inside $(()) is hex" problem.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Thu, 06 Feb 2003 12:08:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897188#M104207</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-06T12:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897189#M104208</link>
      <description>Hi Bala,&lt;BR /&gt;sorry, I am already in holiday mode: I of course mean that the shell belives "09" to be an octal number.&lt;BR /&gt;Alternatively, try to "typeset -i" the following variables in return_seconds.sh, e.g. like this:&lt;BR /&gt;typeset -i DAYS=0 &lt;BR /&gt;typeset -i MONTH=0&lt;BR /&gt;typeset -i YEAR_TO_TEST=0&lt;BR /&gt;typeset -i HOUR=0&lt;BR /&gt;typeset -i SECS=0&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Thu, 06 Feb 2003 12:27:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897189#M104208</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-06T12:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897190#M104209</link>
      <description>Sorry Bala,&lt;BR /&gt;please ignore the alternative solution  suggested in my  previous posting. It will not work, as the input for MONTH can be either numeric, e.g. "09" or string, e.g. "Sep". I suggest you look for a patch solution for making the shell accept that numbers inside $(()) preceeded by zero, e.g. "09", are not regarded as octal values. &lt;BR /&gt;&lt;BR /&gt;regards and regrets,&lt;BR /&gt;John K.</description>
      <pubDate>Thu, 06 Feb 2003 12:38:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897190#M104209</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2003-02-06T12:38:01Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897191#M104210</link>
      <description>Thisd is actually very easy. I assume that you can use awk or cut to extract the Month, Day, and Year values. Caljd.sh can easily recoginze your month names directly and output the number of days since 4713BCE.&lt;BR /&gt;&lt;BR /&gt;e.g&lt;BR /&gt;&lt;BR /&gt;DT1=$(caljd.sh -i Dec 23 2002)&lt;BR /&gt;-- The value is 2452632&lt;BR /&gt;Now&lt;BR /&gt;DT2=$(caljd.sh -i Dec 25 2002)&lt;BR /&gt;-- The value is 2452634&lt;BR /&gt;&lt;BR /&gt;Now &lt;BR /&gt;DAYS_DIFF=$((${DT2} - ${DT1}))&lt;BR /&gt;&lt;BR /&gt;echo "Diff = ${DAYS_DIFF}"&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for usage and many examples. &lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 15:23:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897191#M104210</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-02-06T15:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897192#M104211</link>
      <description>Yes John,&lt;BR /&gt;&lt;BR /&gt;You are correct .... it's treating $((09)) as hex .... i reproduced the error below :&lt;BR /&gt;&lt;BR /&gt;fuji#&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 09 10 10 10&lt;BR /&gt;./return_seconds.sh[215]: 09 - 1 : The specified number is not valid for this command.&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 08 10 10 10&lt;BR /&gt;./return_seconds.sh[215]: 08 - 1 : The specified number is not valid for this command.&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 07 10 10 10&lt;BR /&gt;21550210&lt;BR /&gt;fuji#&lt;BR /&gt;fuji#&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 07 10 10 09&lt;BR /&gt;./return_seconds.sh[274]: 09 : The specified number is not valid for this command.&lt;BR /&gt;fuji#&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 07 10 09 10&lt;BR /&gt;./return_seconds.sh[269]: 09 * 60: The specified number is not valid for this command.&lt;BR /&gt;fuji#&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 07 09 10 10&lt;BR /&gt;./return_seconds.sh[264]: 09 * 60 * 60: The specified number is not valid for this command.&lt;BR /&gt;fuji#&lt;BR /&gt;fuji# ./return_seconds.sh 2002 2002 Sep 07 10 10 07&lt;BR /&gt;21550207&lt;BR /&gt;fuji#&lt;BR /&gt;&lt;BR /&gt;I'm running HP-UX 11.00. &lt;BR /&gt;Since John is on vacation, I would like to request others to help me out. Will you guys ??&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-bala-&lt;BR /&gt;-bala-</description>
      <pubDate>Fri, 07 Feb 2003 06:56:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897192#M104211</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-07T06:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897193#M104212</link>
      <description>Since you seemed to be stuck, I spent about 3 minutes whipping together a shell script which creates an awk script that it turns calls caljd.sh to do the calculations. Make sure that you grab caljd.sh from my earlier posting (and use the latest version 2.1). This should do the trick for you.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Feb 2003 18:54:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897193#M104212</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-02-07T18:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897194#M104213</link>
      <description>I should add that it expects to use your directory listing (or file) as stdin. If your above input listing were 'myfiles.txt' then&lt;BR /&gt;&lt;BR /&gt;deletethem.sh &amp;lt; myfiles.txt&lt;BR /&gt;&lt;BR /&gt;You might also want to comment out the system() function that invokes rm until you feel safe. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 07 Feb 2003 18:57:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897194#M104213</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-02-07T18:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: calculate days between two dates</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897195#M104214</link>
      <description>Thanks Clay and thanks to John too, for your valuable time ...&lt;BR /&gt;&lt;BR /&gt;Being a DBA it helped me a lot in UNIX scripting .....&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;-bala-&lt;BR /&gt;</description>
      <pubDate>Mon, 10 Feb 2003 03:33:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calculate-days-between-two-dates/m-p/2897195#M104214</guid>
      <dc:creator>Bala_8</dc:creator>
      <dc:date>2003-02-10T03:33:43Z</dc:date>
    </item>
  </channel>
</rss>

