Skip to content

Commit

Permalink
Bash sort IPs uniquely
Browse files Browse the repository at this point in the history
  • Loading branch information
apmuthu committed Sep 4, 2024
1 parent 8782b58 commit f44e7f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ curl -s ifconfig.me/ip # Using curl silently without progress bar
wget -qO- ifconfig.me/ip # Using wget quietly
````

### Sort IPs
```bash
# Remove Comments and append new IPs and then:
grep -v "#" ip_blocked.txt | uniq | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n > ip_blocked_sorted.txt
```

### Parse Apache2 access.log
```bash
cat /var/log/apache2/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n 25
Expand Down

0 comments on commit f44e7f0

Please sign in to comment.