snipt

Ctrl+h for KB shortcuts

Bash

awk command for printing out a list of unique IP addresses from an apache access_log

awk '{ip[$1]=0} END {for (address in ip) { print address} }' /home/admin/logs/access_log
https://snipt.net/embed/b40e2bfb63ad279ce459b5d2ee0d1980/
/raw/b40e2bfb63ad279ce459b5d2ee0d1980/
b40e2bfb63ad279ce459b5d2ee0d1980
bash
Bash
1
2019-06-17T23:59:15
True
False
False
/api/public/snipt/6121/
awk-command-for-printing-out-a-list-of-unique-ip-addresses-from-an-apache-access_log
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>awk <span class="s1">&#39;{ip[$1]=0} END {for (address in ip) { print address} }&#39;</span> /home/admin/logs/access_log </span></pre></div> </td></tr></table>
awk, bash