title: How can i do this without "awk" in shell script
body: <p>I want to read a text file with some conditions</p>
  <pre><code>111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 123&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /favicon.ico HTTP/1.1&quot; 404 - &quot;
  111.196.10.3 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 206&quot;
  111.196.10.3 - - [20/Jan/2020:19:43:50 +0200] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 377&quot;
  111.196.10.3 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /sit-3-shine.7.gif HTTP/1.1&quot; 404 - &quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 375&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /sit3-shine.7.gif HTTP/1.1&quot; 200 15811&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 375&quot;
  111.196.10.3 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /sit3-shine.7.gif HTTP/1.1&quot; 200 15811&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  111.196.10.3 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 299&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /sit3-shine.7.gif HTTP/1.1&quot; 200 15811&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 299&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  111.196.10.3 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /sit3-shine.7.gif HTTP/1.1&quot; 200 15811&quot;
  111.196.10.2 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /favicon.ico HTTP/1.1&quot; 404 -&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;HEAD / HTTP/1.1&quot; 304 299&quot;
  111.196.10.3 - - [20/Jan/2020:07:00:50 +0100] &quot;GET / HTTP/1.1&quot; 200 302&quot;
  111.196.10.1 - - [20/Jan/2020:07:00:50 +0100] &quot;GET /thttpd_powered_2.gif HTTP/1.1&quot; 200 2114&quot;
  </code></pre>
  <p>1: I want a script that counts IP addresses in the text file and gives me output like this</p>
  <pre><code>111.196.10.1  8
  111.196.10.2  8
  111.196.10.3  7
  </code></pre>
  <p>for the above, I have written a script</p>
  <pre><code>cat file | awk '{print $1}' | sort | uniq -c | sort -nr | awk '{print $2&quot; &quot;$1}'
  </code></pre>
  <p>it's properly working but I want this without &quot;awk&quot;</p>
  <p>2:my 2nd requirement is, count IP address only when the second last number of the line starts with 2. output will be</p>
  <pre><code>111.196.10.1  7
  111.196.10.3  7
  111.196.10.2  5
  </code></pre>
  <p>for this, I have written a script</p>
  <pre><code>grep '^[^&quot;]*&quot;[^&quot;]*&quot; 2' file | cut -d' ' -f1 | sort | uniq -c | sort -nr | awk '{print $2&quot; &quot;$1}'
  </code></pre>
  <p>it's also properly working but I want this without &quot;awk&quot;</p>