Skip to content

Supportex.NET blog

Server and network management company

  • supportex.net home
  • MySQL Health Test
Menu

All posts tagged awk

AWK: how to get text which is between two strings

Posted on March 17, 2012May 10, 2019Author Oleksii TykhonovPosted in linux

If you need to get some text which is in file between two lines you could use awk for this. You may need it while analyzing access logs to fix some issue, for instance. Here’s how you could do it: awk ‘/2012:00:20:49/, /2012:00:35/’ access_log > output It’s a simple and convenient way.

AWK: quick way to get squid users traffic usage

Posted on August 2, 2011May 10, 2019Author Oleksii TykhonovPosted in linuxLeave a Reply

If you need quick and simple way to get squid users traffic usage you can use this script: #!/bin/bash awk ‘{ user = $8 traffic[user] += $5; } END { OFS = “tt” for (i in traffic) {printf “%s – tt size: %10.2f Mbn”, i, ( traffic[i] / (1024 * 1024 ) ) } }’…

Read

AWK: getting last column value

Posted on July 28, 2011May 10, 2019Author Oleksii TykhonovPosted in linuxLeave a Reply

If you need to get value of last column in awk you can use built-in variable NF which means the number of fields in record. awk ‘$(NF) !~ /-/ { print $0 }’  access_log Or next, if you need next to the last field. And so on. awk ‘$(NF-1) != /-/ { print $0 }’…

Read
Quick MySQL Health Audit

Tags

amqp ansible Apache apt-get awk bash bind CentOS cluster Corosync Debian DNS drbd elasticsearch exclude Fedora firewall go golang innobackupex ipset iptables IPv6 ldap linux logs lsi lspci Lua MaxMind mdadm monitoring Munin mysql mysqldump nagios named ncat nginx niginx openvpn otrs Pacemaker percona perl php phpMyAdmin pika pyenv python python rabbitmq raid redis remote install RRD rrdtool rsync sec Selenium sentry slapd slowlog snmp squid SSH svn swap tips Ubuntu vb-accelerator vBulletin windows Xtrabackup yum

©2025 Supportex.NET blog | Theme by SuperbThemes.Com