<?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 error in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439066#M356972</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Your problem arises when you do:&lt;BR /&gt;&lt;BR /&gt;grep "$date1 $date2"&lt;BR /&gt;&lt;BR /&gt;The dates in 'syslog.log' are in the format of a three-character month name followed by one space followed by a right-justified, space-filled day.&lt;BR /&gt;&lt;BR /&gt;If you run your code with 'date2=1' you will match (errneously) any day in the month that is a 2-digit day where the first digit is one (1)!&lt;BR /&gt;&lt;BR /&gt;One way to fix this is to declare 'date2' thusly:&lt;BR /&gt;&lt;BR /&gt;# typeset -R2 date2=1&lt;BR /&gt;&lt;BR /&gt;The use of 'typeset' is documented in the 'sh-posix' manpages.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Sat, 13 Jun 2009 21:08:37 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2009-06-13T21:08:37Z</dc:date>
    <item>
      <title>script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439063#M356969</link>
      <description>Hi Admins,&lt;BR /&gt;&lt;BR /&gt;I have a script used for obtain details of logins from syslog.i have assigned data1=Jun  and&lt;BR /&gt;data2=9.&lt;BR /&gt;i can obtain jun 9 login details.But if i change data2=10 ,no output shown.i think this is due to double didgit(10).&lt;BR /&gt;&lt;BR /&gt;please help me on this&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs</description>
      <pubDate>Sat, 13 Jun 2009 19:24:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439063#M356969</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-06-13T19:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439064#M356970</link>
      <description>It might help if we could see the script and what output you are getting and what output you expect to get.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 13 Jun 2009 19:34:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439064#M356970</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2009-06-13T19:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439065#M356971</link>
      <description>Hi patrik,&lt;BR /&gt;&lt;BR /&gt;Thanx for the reply..&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;#date1=`date|awk '{print $2}'`&lt;BR /&gt;#date2=`date|awk '{print $3}'`&lt;BR /&gt;date1=Jun&lt;BR /&gt;date2=8&lt;BR /&gt;hostname=`hostname`&lt;BR /&gt;echo "___________________________________________________________________"&lt;BR /&gt;&lt;BR /&gt;echo "             $hostname  - System Login Details                     "&lt;BR /&gt;echo "___________________________________________________________________"&lt;BR /&gt;&lt;BR /&gt;echo "DATE            TIME             ID          FROM IP      "&lt;BR /&gt;echo "___________________________________________________________________"&lt;BR /&gt;grep -i sshd syslog.log|grep -i keyboard-interactive |grep "$date1  $date2" |awk&lt;BR /&gt; '{print $1" "$2"            "$3"       "$9"       "$11}'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the script gives details of logins on that day.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;himacs</description>
      <pubDate>Sat, 13 Jun 2009 19:36:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439065#M356971</guid>
      <dc:creator>himacs</dc:creator>
      <dc:date>2009-06-13T19:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439066#M356972</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Your problem arises when you do:&lt;BR /&gt;&lt;BR /&gt;grep "$date1 $date2"&lt;BR /&gt;&lt;BR /&gt;The dates in 'syslog.log' are in the format of a three-character month name followed by one space followed by a right-justified, space-filled day.&lt;BR /&gt;&lt;BR /&gt;If you run your code with 'date2=1' you will match (errneously) any day in the month that is a 2-digit day where the first digit is one (1)!&lt;BR /&gt;&lt;BR /&gt;One way to fix this is to declare 'date2' thusly:&lt;BR /&gt;&lt;BR /&gt;# typeset -R2 date2=1&lt;BR /&gt;&lt;BR /&gt;The use of 'typeset' is documented in the 'sh-posix' manpages.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Sat, 13 Jun 2009 21:08:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439066#M356972</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-06-13T21:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439067#M356973</link>
      <description>&amp;gt;grep "$date1 $date2"&lt;BR /&gt;&lt;BR /&gt;This can be fixed by regexp:&lt;BR /&gt;grep "$date1 *$date2"&lt;BR /&gt;&lt;BR /&gt;&amp;gt;JRF: three-character month name followed by one space followed by a right-justified, space-filled day.&lt;BR /&gt;&lt;BR /&gt;This is just broken.  They should be fixed fields and zero filled.&lt;BR /&gt;I know there are some locales that have space filled and other more evil ones that aren't even fixed widths.  But syslog should follow American nerd and be easy to parse.</description>
      <pubDate>Sun, 14 Jun 2009 02:00:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439067#M356973</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-06-14T02:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439068#M356974</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;besides the fact, that the multiple 'grep' pipeline could be done completely in awk, I would at least subsitute the last part in adressing Dennis' remark from&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;... |grep "$date1 $date2" |awk&lt;BR /&gt;'{print $1" "$2" "$3" "$9" "$11}' &lt;BR /&gt;&amp;lt;&amp;lt;&lt;BR /&gt;to (assuming month-&amp;gt; field 1 ($1); day-&amp;gt; field 2 ($2) )&lt;BR /&gt;&lt;BR /&gt;... | awk -v mon=$data1 -v day=$data2 '$1 == mon &amp;amp;&amp;amp; $2 == day {print $1" "$2" "$3" "$9" "$11}'&lt;BR /&gt;&lt;BR /&gt;awk will accept any amount of whitespace here when determining fields.&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Sun, 14 Jun 2009 18:41:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4439068#M356974</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2009-06-14T18:41:15Z</dc:date>
    </item>
  </channel>
</rss>

