#!/usr/bin/perl
#
# Nathanial Hendle
# http://retards.org/
#
# 2001-06-26 v1.0
#
# This perl script parses a MySQL slow_queries log file
# ignoring all queries less than $min_time and prints
# out how many times a query was greater than $min_time
# with the seconds it took each time to run. The queries
# are sorted by number of times it took; the most often
# query appearing at the bottom of the output.
#
# Usage: mysql_slow_log_parser logfile
#
# ------------------------
# SOMETHING TO THINK ABOUT (aka: how to read output)
# ------------------------
#
# Also, it does to regex substitutions to normalize
# the queries...
#
# $query_string =~ s/d /XXX/g;
# $query_string =~ s/(['"]). ?(['"])/$1XXX$2/g;
#
# These replace numbers with XXX and strings found in
# quotes with XXX so that the same select statement
# with different WHERE clauses will be considered
# as the same query.
#
# so these...
#
# SELECT * FROM offices WHERE office_id = 3;
# SELECT * FROM offices WHERE office_id = 19;
#
# become...
#
# SELECT * FROM offices WHERE office_id = XXX;
#
#
# And these...
#
# SELECT * FROM photos WHERE camera_model LIKE 'Nikon%';
# SELECT * FROM photos WHERE camera_model LIKE '%Olympus';
#
# become...
#
# SELECT * FROM photos WHERE camera_model LIKE 'XXX';
#
#
# ---------------------
# THIS MAY BE IMPORTANT (aka: Probably Not)
# ---------------------
#
# *SO* if you use numbers in your table names, or column
# names, you might get some oddities, but I doubt it.
# I mean, how different should the following queries be
# considered?
#
# SELECT car1 FROM autos_10;
# SELECT car54 FROM autos_11;
#
# I don't think so.
#
sed修改grub文件,一句话脚本,简单实用
sed -i '/vmlinuz-2.6.32-358/s@rd_NO_DM.*@rd_NO_DM acpi_pad.disable=1@' /etc/grub.conf