cat x.tmp | awk '{sum += $0} END {print sum}'
Category Archives: Uncategorized
Running SARG for Squid Log Analysis and Reports
sarg -i -o /var/www/html/sarg -l /tmp/access.log
Find and Display Text Between Two Strings or Words
# sed -n '/<VirtualHost*/,/<\/VirtualHost>/p' /etc/httpd/conf/httpd.conf
Parse the squid log file to sum up all the request size
echo $(( $(cat /var/log/squid/access.log | grep -v "DENIED" | awk '{print $5}' | tr '\n' '+' ) 0 ))
Convert unixtime to human readable format in squid's access.log file
perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e' < /var/log/squid/access.log
Installing new kernel in Centos/Fedora
yum install kernel
Deleting a single IPTables rule
iptables -L INPUT -n –line-numbers iptables -D INPUT 4
Sending email with mail command – with from and CC addresses
echo "Message body" | mail -s "Message Subject" abc@domain.tld -c def@domain.tld -f ghi@domain.tld
Determine block size of a disk
dumpe2fs /dev/sda1 | grep -i 'block size'
Retrieving date and time from squid access.log file
perl -pe 's/[\d\.]+/localtime($&)/e' /squid/access.log