<?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: grep dates on snmp collected data in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138917#M75116</link>
    <description>Hello Seun,&lt;BR /&gt;&lt;BR /&gt;egrep '^1[0-5]/.*/2003' snmp.log&lt;BR /&gt;&lt;BR /&gt;will get the 10th to the 15th.&lt;BR /&gt;If you reallz want to know Mo to Fr I suggest you write a little Perl program to get the weekday of a given date and the take it from there.&lt;BR /&gt;&lt;BR /&gt;Greetings, Martin</description>
    <pubDate>Mon, 08 Dec 2003 14:32:35 GMT</pubDate>
    <dc:creator>Martin P.J. Zinser</dc:creator>
    <dc:date>2003-12-08T14:32:35Z</dc:date>
    <item>
      <title>grep dates on snmp collected data</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138916#M75115</link>
      <description>Hi people,&lt;BR /&gt;&lt;BR /&gt;I use egrep to grep on data of the format below&lt;BR /&gt;&lt;BR /&gt;10/11/2003 00:00 299 0.43 0.45 140.54 68.34 72.2 32&lt;BR /&gt;11/11/2003 00:05 301 0.25 0.34 93.56 39.77 53.78 28&lt;BR /&gt;12/11/2003 00:10 300 0.34 0.37 113.91 54.08 59.83 32&lt;BR /&gt;&lt;BR /&gt;1) To see all data for just a certain day I usually do &lt;BR /&gt;grep '^10/.*/2003' &lt;SNMP.LOG&gt;&lt;BR /&gt;&lt;BR /&gt;2)to see all data for some days I usually do &lt;BR /&gt;egrep -e '11/.*/2003' -e '12/.*/2003' snmp.log&lt;BR /&gt;&lt;BR /&gt;Now if I want to see the all data for example from 10/11/2003 - 15/11/2003 how would this be done with awk, egrep or sed.&lt;BR /&gt;&lt;BR /&gt;My main aim is to see/filter all data in a snmp log file just for mondays-fridays and omitting all the weekend dates.&lt;BR /&gt;&lt;BR /&gt;Any help or advice will be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;seun&lt;/SNMP.LOG&gt;</description>
      <pubDate>Mon, 08 Dec 2003 13:18:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138916#M75115</guid>
      <dc:creator>Seun Ewulomi_1</dc:creator>
      <dc:date>2003-12-08T13:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: grep dates on snmp collected data</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138917#M75116</link>
      <description>Hello Seun,&lt;BR /&gt;&lt;BR /&gt;egrep '^1[0-5]/.*/2003' snmp.log&lt;BR /&gt;&lt;BR /&gt;will get the 10th to the 15th.&lt;BR /&gt;If you reallz want to know Mo to Fr I suggest you write a little Perl program to get the weekday of a given date and the take it from there.&lt;BR /&gt;&lt;BR /&gt;Greetings, Martin</description>
      <pubDate>Mon, 08 Dec 2003 14:32:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138917#M75116</guid>
      <dc:creator>Martin P.J. Zinser</dc:creator>
      <dc:date>2003-12-08T14:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: grep dates on snmp collected data</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138918#M75117</link>
      <description>I'd have to agree with Martin on this one (although his grep is good).&lt;BR /&gt;&lt;BR /&gt;As all the entires should be in sequential date/time order, it should be easy to do a simple check against the first field and print it if it exceeds the given date pair provided.</description>
      <pubDate>Mon, 08 Dec 2003 17:22:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138918#M75117</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2003-12-08T17:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: grep dates on snmp collected data</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138919#M75118</link>
      <description>For a little help on the above mentioned script, it might be useful to know that if you take the year, month and day, in that order and find a mod 7, you get the day number (with Sunday being a 0)&lt;BR /&gt; &lt;BR /&gt;for example, taking your first date of 10/11/2003 you reverse the date and take a mod 7&lt;BR /&gt; &lt;BR /&gt;20031110%7 which gives you 1, so that date is a Monday.</description>
      <pubDate>Tue, 09 Dec 2003 08:16:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138919#M75118</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-09T08:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: grep dates on snmp collected data</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138920#M75119</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;as for a Perl solution, you could have a look at the Date::Manip module, which does provide the handy Date_IsWorkDay function for such purposes...&lt;BR /&gt;&lt;BR /&gt;Greetings, Martin</description>
      <pubDate>Tue, 09 Dec 2003 13:36:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138920#M75119</guid>
      <dc:creator>Martin P.J. Zinser</dc:creator>
      <dc:date>2003-12-09T13:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: grep dates on snmp collected data</title>
      <link>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138921#M75120</link>
      <description>Here you go:&lt;BR /&gt;[diciu@bluefish diciu]$ cat tt&lt;BR /&gt;10/11/2003 00:00 299 0.43 0.45 140.54 68.34 72.2 32&lt;BR /&gt;11/11/2003 00:05 301 0.25 0.34 93.56 39.77 53.78 28&lt;BR /&gt;12/11/2003 00:10 300 0.34 0.37 113.91 54.08 59.83 32&lt;BR /&gt;&lt;BR /&gt;[diciu@bluefish diciu]$ cat tt.sh &lt;BR /&gt;cat tt | while read sw&lt;BR /&gt;do&lt;BR /&gt;weekday=`echo $sw | cut -b0-10 | xargs date +%a -d `&lt;BR /&gt;ismatch=`echo $weekday | egrep -v "(^Sun$)|(^Sat$)"`&lt;BR /&gt;&lt;BR /&gt;if [ "$ismatch" ]; then&lt;BR /&gt;echo $sw&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;[diciu@bluefish diciu]$ sh tt.sh&lt;BR /&gt;11/11/2003 00:05 301 0.25 0.34 93.56 39.77 53.78 28&lt;BR /&gt;12/11/2003 00:10 300 0.34 0.37 113.91 54.08 59.83 32&lt;BR /&gt;&lt;BR /&gt;tt is the data file.&lt;BR /&gt;tt.sh is the filter script (also attached in case the forum eats special characters).</description>
      <pubDate>Wed, 10 Dec 2003 02:25:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/grep-dates-on-snmp-collected-data/m-p/3138921#M75120</guid>
      <dc:creator>Cristian Draghici</dc:creator>
      <dc:date>2003-12-10T02:25:20Z</dc:date>
    </item>
  </channel>
</rss>

