Skip to content

Instantly share code, notes, and snippets.

@biggora
Created August 7, 2015 08:32
Show Gist options
  • Save biggora/1e9d1992d6eb8b497c01 to your computer and use it in GitHub Desktop.
Save biggora/1e9d1992d6eb8b497c01 to your computer and use it in GitHub Desktop.
Bash commads
# split string by space
# awk -F " " '{print $7}'
# example: show banned ip
cat /var/log/fail2ban.log | grep Ban | awk -F " " '{print $7}'
# count unique value
# sort | uniq -c | sort -nr
# example: count banned unique ip
cat /var/log/fail2ban.log | grep Ban | awk -F " " '{print $7}' | sort | uniq -c | sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment