<?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: Scripting Query in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270134#M52879</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for the feedback! Spot on Dennis with the tr command for the non delimited file also.&lt;BR /&gt;&lt;BR /&gt;Using 'tr' I replaced the spaces with a new line and redirected the output to a new file then used the sort/uniq/sort pipeline as suggested and it produces the desired result.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;D.</description>
    <pubDate>Wed, 19 Jan 2011 16:43:18 GMT</pubDate>
    <dc:creator>Duffs</dc:creator>
    <dc:date>2011-01-19T16:43:18Z</dc:date>
    <item>
      <title>Scripting Query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270129#M52874</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to find out the IP address that has got written most frequently to my access_log file. The file is a few thousand lines and therefore it is not practical to view this manually. I have tried to select the first column in the access_file and print it, sort it and simply eyeball the result but with so many different addresses there must be a more solid way of doing it?&lt;BR /&gt;&lt;BR /&gt;i.e.&lt;BR /&gt;# cat access_log | awk '{print $1}' | sort -rn &amp;gt; /tmp/access.txt&lt;BR /&gt;&lt;BR /&gt;And this leads on to my next question which is if I was looking for the most frequent entry in a file but not necessarily an IP address how could I get it if it wasn't delimited by colums and could be of any alphanumerical value?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;D.</description>
      <pubDate>Mon, 17 Jan 2011 10:01:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270129#M52874</guid>
      <dc:creator>Duffs</dc:creator>
      <dc:date>2011-01-17T10:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270130#M52875</link>
      <description>Hello.&lt;BR /&gt;&lt;BR /&gt;Write a trivial awk or perl script using hash arrays.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Goran</description>
      <pubDate>Mon, 17 Jan 2011 10:39:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270130#M52875</guid>
      <dc:creator>Goran Koruga</dc:creator>
      <dc:date>2011-01-17T10:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270131#M52876</link>
      <description>&amp;gt;I am trying to find out the IP address that has got written most frequently&lt;BR /&gt;&lt;BR /&gt;Try:&lt;BR /&gt;awk '{print $1}' access_log | sort | uniq -c | sort -rn &amp;gt; /tmp/access.txt&lt;BR /&gt;&lt;BR /&gt;&amp;gt;if it wasn't delimited by columns and could be of any alphanumerical value?&lt;BR /&gt;&lt;BR /&gt;Are you trying to find the most frequently occurring "word" in a file?&lt;BR /&gt;You could use tr(1) to convert your separators to a newline then use the above sort/uniq/sort pipeline.  (Removing blank lines first.)</description>
      <pubDate>Tue, 18 Jan 2011 00:29:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270131#M52876</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-01-18T00:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270132#M52877</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you could use 'webalizer' to parse the access_log for you, as it does all the sorting on your behalf, then use curl to pull back the stats page.&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;&lt;BR /&gt;Matt</description>
      <pubDate>Tue, 18 Jan 2011 07:30:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270132#M52877</guid>
      <dc:creator>Matt Palmer_2</dc:creator>
      <dc:date>2011-01-18T07:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270133#M52878</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Denis, yes I am trying to find the most frequently used word in a file. Are there any alternatives to 'tr' or is this the only way of doing it? What would the command look like to obtain this.&lt;BR /&gt;&lt;BR /&gt;R,&lt;BR /&gt;D.</description>
      <pubDate>Wed, 19 Jan 2011 09:56:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270133#M52878</guid>
      <dc:creator>Duffs</dc:creator>
      <dc:date>2011-01-19T09:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Query</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270134#M52879</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for the feedback! Spot on Dennis with the tr command for the non delimited file also.&lt;BR /&gt;&lt;BR /&gt;Using 'tr' I replaced the spaces with a new line and redirected the output to a new file then used the sort/uniq/sort pipeline as suggested and it produces the desired result.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;D.</description>
      <pubDate>Wed, 19 Jan 2011 16:43:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-query/m-p/5270134#M52879</guid>
      <dc:creator>Duffs</dc:creator>
      <dc:date>2011-01-19T16:43:18Z</dc:date>
    </item>
  </channel>
</rss>

