<?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: finding date in wtmp in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814356#M85137</link>
    <description>Within ksh you can use typeset to force a variable to be two characters (with blank padding).&lt;BR /&gt;&lt;BR /&gt;typeset -R2 daynum=6&lt;BR /&gt;&lt;BR /&gt;Then when you use $daynum in your script it will have the extra space.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
    <pubDate>Thu, 26 Sep 2002 20:27:51 GMT</pubDate>
    <dc:creator>Rodney Hills</dc:creator>
    <dc:date>2002-09-26T20:27:51Z</dc:date>
    <item>
      <title>finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814348#M85129</link>
      <description>I want to search for a calculated date in a converted wtmp file, but am not able to get extra space in single digit dates in order to match the format in the converted wtmp.&lt;BR /&gt;&lt;BR /&gt;e.g. excerpt from line in wtmp ... Jun  6&lt;BR /&gt;Note, the extra space between month and 6.  When I calculate a date, I can't get the extra space in there.  Please help.</description>
      <pubDate>Thu, 26 Sep 2002 18:31:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814348#M85129</guid>
      <dc:creator>Dalin Bruns</dc:creator>
      <dc:date>2002-09-26T18:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814349#M85130</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;How do you want to calculate the date and how do you want to search?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Sep 2002 18:37:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814349#M85130</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-26T18:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814350#M85131</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Try this way&lt;BR /&gt;&lt;BR /&gt;DAY=$(date +%d)&lt;BR /&gt;MONTH=$(date +%b)&lt;BR /&gt;DATE=$(printf "%s %2.3s" $MONTH $DAY)&lt;BR /&gt;last -R |grep "$DATE"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The above is only example. You can use that logic in your script.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 26 Sep 2002 18:47:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814350#M85131</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-09-26T18:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814351#M85132</link>
      <description>interesting ... the extra space got taken out of my example.  &lt;BR /&gt;&lt;BR /&gt;Here's what I want to do.  I want to keep the last 90 days of data in my wtmp, deleting the rest.  I have calculated 90 days prior to today.  My next step was going to be determining the line number matching my calc'd date and delete all previous lines.  Something along these lines ...&lt;BR /&gt;&lt;BR /&gt;X=grep -n "Jun  6" wtmp.tmp | head -1 | cut -d : -f 1&lt;BR /&gt;&lt;BR /&gt;sed '1,Xd' wtmp.tmp &amp;gt; wtmp.clean&lt;BR /&gt;&lt;BR /&gt;I know that isn't all correct, but I'm new to this scripting thing (coming from Win env) and I haven't worked out all the details.  Any help would be greatly appreciated.</description>
      <pubDate>Thu, 26 Sep 2002 18:49:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814351#M85132</guid>
      <dc:creator>Dalin Bruns</dc:creator>
      <dc:date>2002-09-26T18:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814352#M85133</link>
      <description>Hi Dalin:&lt;BR /&gt;&lt;BR /&gt;Your approach is fine.  Do this:&lt;BR /&gt;&lt;BR /&gt;X='Jun  6' #...there are really 2-blanks here...&lt;BR /&gt;      &lt;BR /&gt;# sed -e "1,/$X/"d filein&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Sep 2002 19:03:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814352#M85133</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-26T19:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814353#M85134</link>
      <description>Thanks guys ... couldn't get Sri's to show extra space on my system after modifying date line to calculate back enough days to get in single digits, but it was a new approach ... James thanks for pointing out how to avoid all of that line number stuff.  But, I still have the extra space issue.&lt;BR /&gt;&lt;BR /&gt;I'm now thinking that I may have to awk out the month and day from the appropriate columns of the wtmp.tmp file and then match on both.&lt;BR /&gt;&lt;BR /&gt;WDYT?</description>
      <pubDate>Thu, 26 Sep 2002 20:14:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814353#M85134</guid>
      <dc:creator>Dalin Bruns</dc:creator>
      <dc:date>2002-09-26T20:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814354#M85135</link>
      <description>Hi Dalin,&lt;BR /&gt;&lt;BR /&gt;If you look at the value of $DATE, it will have two spaces for a single digit date and one space for double digit date from the month's field.&lt;BR /&gt;&lt;BR /&gt;If you already calculated the date, it is easy to create an extra space between the month and the day using printf statement but you have to first devide the date into day and month as I did in the example.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 26 Sep 2002 20:22:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814354#M85135</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-09-26T20:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814355#M85136</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;If you folllow Sri's use of 'printf' you can construct the "$X" argument to the 'sed' I suggested.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 26 Sep 2002 20:26:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814355#M85136</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2002-09-26T20:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814356#M85137</link>
      <description>Within ksh you can use typeset to force a variable to be two characters (with blank padding).&lt;BR /&gt;&lt;BR /&gt;typeset -R2 daynum=6&lt;BR /&gt;&lt;BR /&gt;Then when you use $daynum in your script it will have the extra space.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Thu, 26 Sep 2002 20:27:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814356#M85137</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2002-09-26T20:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: finding date in wtmp</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814357#M85138</link>
      <description>I tried again and it works!!  Thanks for your suggestions.  I am now well down the road to cleaning up my wtmp files.&lt;BR /&gt;&lt;BR /&gt;Dalin</description>
      <pubDate>Fri, 27 Sep 2002 11:33:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/finding-date-in-wtmp/m-p/2814357#M85138</guid>
      <dc:creator>Dalin Bruns</dc:creator>
      <dc:date>2002-09-27T11:33:12Z</dc:date>
    </item>
  </channel>
</rss>

